mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 12:31:30 -10:00
Compare commits
424
Commits
1531798
...
hotfix-19334
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
074b47c890 | ||
|
|
ba6b10b69c | ||
|
|
41e151d8b5 | ||
|
|
de2f33f7b2 | ||
|
|
7569e1a18d | ||
|
|
933e19bca3 | ||
|
|
501f5a9ed6 | ||
|
|
1538a59191 | ||
|
|
5892cd77a0 | ||
|
|
c82a2e5074 | ||
|
|
d778fb3631 | ||
|
|
a813491664 | ||
|
|
f0c92250f1 | ||
|
|
dc0ce1d96e | ||
|
|
76cd0085cc | ||
|
|
ef27535985 | ||
|
|
18666b6e21 | ||
|
|
3016bd7f31 | ||
|
|
9331fc979b | ||
|
|
4e94779847 | ||
|
|
12fd95f950 | ||
|
|
e1edabc081 | ||
|
|
3a4aeaa649 | ||
|
|
a067aa1cc7 | ||
|
|
2d61e91f57 | ||
|
|
cba1d4ffa1 | ||
|
|
eef579fa97 | ||
|
|
be40f3f97e | ||
|
|
40a3eb5354 | ||
|
|
1b35c8b74a | ||
|
|
b92d2bd239 | ||
|
|
00d88a51af | ||
|
|
aaa6f3c3fc | ||
|
|
b75fa2b333 | ||
|
|
84068e57b7 | ||
|
|
92be1aebdb | ||
|
|
7138ab117f | ||
|
|
09d18d4f47 | ||
|
|
75b30d0fd9 | ||
|
|
b813e56737 | ||
|
|
117302400a | ||
|
|
399facb8ca | ||
|
|
2311da7b9a | ||
|
|
5b3813b1d2 | ||
|
|
2e5167402b | ||
|
|
bf54221823 | ||
|
|
f9afcf06b9 | ||
|
|
d955217874 | ||
|
|
d457bae593 | ||
|
|
6e152a16a1 | ||
|
|
a824dad5f6 | ||
|
|
55fcfb81be | ||
|
|
f8691c441b | ||
|
|
2f569721a7 | ||
|
|
f07e7d0850 | ||
|
|
a9a6e86072 | ||
|
|
219bd64946 | ||
|
|
255a8971e5 | ||
|
|
91a4a3d504 | ||
|
|
6d5c45d559 | ||
|
|
5e1afc4533 | ||
|
|
e7da99bb17 | ||
|
|
e9e611d501 | ||
|
|
cefe30a5cc | ||
|
|
928436efc6 | ||
|
|
838ec2fb6f | ||
|
|
45d8971caa | ||
|
|
cf53f2aab3 | ||
|
|
f2c520372f | ||
|
|
3bc58c925b | ||
|
|
3790413f38 | ||
|
|
ef4965a6dd | ||
|
|
7cb75c8355 | ||
|
|
90a83b65df | ||
|
|
96a5c1247e | ||
|
|
b5a5402beb | ||
|
|
9d2eec1131 | ||
|
|
a825298e9d | ||
|
|
e11a0b175d | ||
|
|
2f5ddd0210 | ||
|
|
dcdc8414df | ||
|
|
2e8f21d4f2 | ||
|
|
7e8a11f888 | ||
|
|
872e97cb30 | ||
|
|
36c9c006bc | ||
|
|
137718d9b4 | ||
|
|
424d1cdc8b | ||
|
|
328defdcde | ||
|
|
e0dab7749a | ||
|
|
e4b431e3a5 | ||
|
|
039ffcafca | ||
|
|
717c6de1cc | ||
|
|
13fd028ee8 | ||
|
|
80ca0394cd | ||
|
|
8b80178115 | ||
|
|
447975c12c | ||
|
|
7174b069cf | ||
|
|
45d831259b | ||
|
|
c170351fde | ||
|
|
e55e70f8c7 | ||
|
|
5a234d5d16 | ||
|
|
0635a83c89 | ||
|
|
ff1817f017 | ||
|
|
d663c9f65c | ||
|
|
8f9a74f2f6 | ||
|
|
dc30595ace | ||
|
|
f7fd52ad18 | ||
|
|
84472a332e | ||
|
|
c19e821763 | ||
|
|
e867622025 | ||
|
|
c46234bf0c | ||
|
|
9b7b75d7ec | ||
|
|
3fd3541704 | ||
|
|
8630afbd9b | ||
|
|
8da186ea62 | ||
|
|
976be34045 | ||
|
|
e6b335e7f7 | ||
|
|
3d9a2b7175 | ||
|
|
ede4f3a8c6 | ||
|
|
e1da8e304d | ||
|
|
2d3dd5a40a | ||
|
|
87f4b14752 | ||
|
|
916abe5f57 | ||
|
|
8d9f05ea9a | ||
|
|
de8ca8fdf6 | ||
|
|
6ec1ebf990 | ||
|
|
a142d922aa | ||
|
|
21656fd89f | ||
|
|
bb86670c28 | ||
|
|
87e7f1c2d7 | ||
|
|
e15463e38a | ||
|
|
c4f72def57 | ||
|
|
2a14bc4dad | ||
|
|
63eb94b524 | ||
|
|
066bdb9c24 | ||
|
|
a26b297e11 | ||
|
|
18cd82b380 | ||
|
|
1daac38948 | ||
|
|
4619f9f070 | ||
|
|
d3788f892f | ||
|
|
26364535a0 | ||
|
|
639413ef89 | ||
|
|
6716d439e9 | ||
|
|
c3bd8334a3 | ||
|
|
8410c9bb00 | ||
|
|
5ae9f7d93f | ||
|
|
ce348f12da | ||
|
|
643ad918e0 | ||
|
|
e9ef2be437 | ||
|
|
7eeb7f14f3 | ||
|
|
0db6c1418f | ||
|
|
6edd8bf89e | ||
|
|
b67c4fe1c5 | ||
|
|
36bfeec103 | ||
|
|
77f9b3dc10 | ||
|
|
ddb83ce172 | ||
|
|
6f53824f35 | ||
|
|
97866fc145 | ||
|
|
c5d4e39545 | ||
|
|
1189d3706a | ||
|
|
885b065e06 | ||
|
|
45deb48384 | ||
|
|
b0077e8c2a | ||
|
|
1784575ef2 | ||
|
|
5a4cd56c04 | ||
|
|
04967b8dba | ||
|
|
ba6a479e5d | ||
|
|
179fbf4b23 | ||
|
|
8e6ae13499 | ||
|
|
b58da19a66 | ||
|
|
2ec479b762 | ||
|
|
bf87077ac9 | ||
|
|
e78e74cc1c | ||
|
|
727f8fe28d | ||
|
|
a9f31e63db | ||
|
|
30ed59ce3e | ||
|
|
60d10d5464 | ||
|
|
54f5b48d44 | ||
|
|
88ed113252 | ||
|
|
855bb5648b | ||
|
|
55fc7c277f | ||
|
|
123d9a05db | ||
|
|
8f41328a78 | ||
|
|
4cba98f8c0 | ||
|
|
3b484c1fcb | ||
|
|
e3abaa85d8 | ||
|
|
10b5567b3d | ||
|
|
6e4ab1d3eb | ||
|
|
abb760f376 | ||
|
|
f927c83afe | ||
|
|
5f2f74f5de | ||
|
|
02be6a4f28 | ||
|
|
e1af46ef45 | ||
|
|
a487812e61 | ||
|
|
eea8080dad | ||
|
|
a68a793383 | ||
|
|
92d86659ca | ||
|
|
4109ab0ee4 | ||
|
|
43fd14b9d8 | ||
|
|
e92af12248 | ||
|
|
17edd267ab | ||
|
|
c33600f57d | ||
|
|
114a27e57c | ||
|
|
98ce3f76b2 | ||
|
|
54844b08ef | ||
|
|
7724a608a5 | ||
|
|
0e13745ec2 | ||
|
|
00c918e0a9 | ||
|
|
7e034defbc | ||
|
|
f51b9a4bb2 | ||
|
|
c01afa20e8 | ||
|
|
71e152accc | ||
|
|
fbea921536 | ||
|
|
478f99f398 | ||
|
|
ac2d851398 | ||
|
|
c74ca49869 | ||
|
|
c677be429f | ||
|
|
8b90653ff3 | ||
|
|
843fe0b3c6 | ||
|
|
6abce1e8d8 | ||
|
|
10c2cc4d3f | ||
|
|
7cfd463841 | ||
|
|
04f89bb6fe | ||
|
|
aab88e769c | ||
|
|
4cda578c6a | ||
|
|
bd002446fc | ||
|
|
fa2c2870e5 | ||
|
|
a1e558f6c6 | ||
|
|
aea4abc755 | ||
|
|
14d49cce10 | ||
|
|
f533903590 | ||
|
|
7ecf25c7a1 | ||
|
|
5a22dacd4e | ||
|
|
457c87c69f | ||
|
|
b97e3209b3 | ||
|
|
27d26c36cc | ||
|
|
d29a341e73 | ||
|
|
ee90d5ff1d | ||
|
|
84110040aa | ||
|
|
d8ae2993ef | ||
|
|
153d104c07 | ||
|
|
58105a4dc6 | ||
|
|
f39cc88e58 | ||
|
|
9e573872f0 | ||
|
|
2a73a83d89 | ||
|
|
97c6bc06ea | ||
|
|
1a92f4e90b | ||
|
|
374e1b13e0 | ||
|
|
09fc592499 | ||
|
|
306ac05ea1 | ||
|
|
d6848d1ef6 | ||
|
|
b863d3c58d | ||
|
|
411d4aa0bb | ||
|
|
8ab9a76c7e | ||
|
|
b0cff959e4 | ||
|
|
6e27f984ab | ||
|
|
af33ad4eaa | ||
|
|
7a430acd77 | ||
|
|
9523b73148 | ||
|
|
f862057fb1 | ||
|
|
c1fe551f9c | ||
|
|
4c6a463678 | ||
|
|
e7778f3fd5 | ||
|
|
4437ecea91 | ||
|
|
1317d99cae | ||
|
|
1e709688bb | ||
|
|
da3b7dd271 | ||
|
|
3e3fe21e7f | ||
|
|
d525ff73e1 | ||
|
|
16dbea555d | ||
|
|
709d2c58ad | ||
|
|
9be262f8cc | ||
|
|
88297792e7 | ||
|
|
aa73f76a34 | ||
|
|
b86bd886d6 | ||
|
|
c856758e54 | ||
|
|
d659d7540d | ||
|
|
87454f9f83 | ||
|
|
0ac61b03fc | ||
|
|
52834175e1 | ||
|
|
9aaf79b055 | ||
|
|
fc7c8e9765 | ||
|
|
d171cdf5e2 | ||
|
|
a49bd2664f | ||
|
|
7ece665d16 | ||
|
|
497481742a | ||
|
|
999e88dcd5 | ||
|
|
01ffcd4145 | ||
|
|
2476a1b728 | ||
|
|
c9044d71bb | ||
|
|
4e3ca74fcb | ||
|
|
ada4b4b06f | ||
|
|
1fbdf06d04 | ||
|
|
c70c3c429a | ||
|
|
a12c4b8099 | ||
|
|
e8efdfa360 | ||
|
|
ac83118056 | ||
|
|
70980c0cde | ||
|
|
0cfc7008a0 | ||
|
|
8e714a70a1 | ||
|
|
18ee4f22a3 | ||
|
|
62df12c0e4 | ||
|
|
aa82365b6b | ||
|
|
0f7be7ca38 | ||
|
|
aa8cabc373 | ||
|
|
53b798f915 | ||
|
|
533b11a0f6 | ||
|
|
78408ae100 | ||
|
|
72c15bb6f2 | ||
|
|
96e37d79b3 | ||
|
|
003488cc2a | ||
|
|
c2022b34b7 | ||
|
|
d07b7650c7 | ||
|
|
050ee93a67 | ||
|
|
8a005b8290 | ||
|
|
06ba93fd0e | ||
|
|
2a4230fe3b | ||
|
|
67297b2710 | ||
|
|
7968a8df16 | ||
|
|
f1ca57ebb3 | ||
|
|
5d762ffe93 | ||
|
|
22a218578a | ||
|
|
84f9d58737 | ||
|
|
1e5638b59c | ||
|
|
75eb6a9caf | ||
|
|
b533e2abac | ||
|
|
9ac8be28af | ||
|
|
5d3a42dc0f | ||
|
|
63f50e9a1a | ||
|
|
a5439f9646 | ||
|
|
f289255ed5 | ||
|
|
657b6caad6 | ||
|
|
2f9fb9e888 | ||
|
|
d90ab2a697 | ||
|
|
bb12899b3a | ||
|
|
bd3f6f5abc | ||
|
|
13e0175fc8 | ||
|
|
a32e2c7fe6 | ||
|
|
cca43a2d34 | ||
|
|
f234e421ae | ||
|
|
c648f28f54 | ||
|
|
62edb78cd6 | ||
|
|
681a0061ad | ||
|
|
c93f120211 | ||
|
|
1210628a04 | ||
|
|
1641a095bb | ||
|
|
0567e7763e | ||
|
|
aa11aa6184 | ||
|
|
0e37ed19be | ||
|
|
96b46d1ad0 | ||
|
|
a59c434f46 | ||
|
|
916121f3d7 | ||
|
|
007413298d | ||
|
|
c5cf618a14 | ||
|
|
6c4bc5f9d7 | ||
|
|
11049f9dd7 | ||
|
|
cab1c00168 | ||
|
|
6ee08cf772 | ||
|
|
4d7a441967 | ||
|
|
8d405e7aa1 | ||
|
|
410af9c0cc | ||
|
|
8f2377e855 | ||
|
|
92a4fd26ac | ||
|
|
ee71f0a1e6 | ||
|
|
40ccf510c6 | ||
|
|
d7c598b74c | ||
|
|
5ddcc07c67 | ||
|
|
294e5214b2 | ||
|
|
546831886e | ||
|
|
5d4b1f978b | ||
|
|
4320e844e9 | ||
|
|
f5f69e540e | ||
|
|
c6ab899595 | ||
|
|
67ea9985cb | ||
|
|
e150fde4e2 | ||
|
|
de0543fbea | ||
|
|
1d94d1770d | ||
|
|
ff165854bd | ||
|
|
db5275ca56 | ||
|
|
da335abfba | ||
|
|
2b5078c306 | ||
|
|
a8185f3374 | ||
|
|
c30a3e46d2 | ||
|
|
feacff0185 | ||
|
|
6fe521be5c | ||
|
|
7d3eaf50a8 | ||
|
|
18186487ee | ||
|
|
d127a1a911 | ||
|
|
42173889e7 | ||
|
|
7c7ae04f7f | ||
|
|
116f4d2749 | ||
|
|
d56a23750b | ||
|
|
0699e4da36 | ||
|
|
b89b5c46d6 | ||
|
|
84ab6a7833 | ||
|
|
b6874fa16b | ||
|
|
f6f80d5e4d | ||
|
|
2d52cec1ce | ||
|
|
e074772e92 | ||
|
|
b63c44670a | ||
|
|
2cf751f7f7 | ||
|
|
ac52aece46 | ||
|
|
745a2b16ec | ||
|
|
b0523c4ee8 | ||
|
|
627fc398ad | ||
|
|
19619d925e | ||
|
|
82c15fa592 | ||
|
|
40ca3ae249 | ||
|
|
24013364b7 | ||
|
|
16d9d07821 | ||
|
|
74b76bdc11 | ||
|
|
0f36581baa | ||
|
|
b99e7ab957 | ||
|
|
32318db8cf | ||
|
|
ef94fbfd9c | ||
|
|
5ad92e6b10 | ||
|
|
fb3a6d1cd2 | ||
|
|
c47fab9285 | ||
|
|
452073b91e | ||
|
|
edca3467ce | ||
|
|
a83e9cf4aa | ||
|
|
8b9c60075f | ||
|
|
6354f74888 | ||
|
|
8e9da60e99 |
No files matched your search
@@ -69,6 +69,7 @@ config.status
|
||||
config.sub
|
||||
configure
|
||||
configure.scan
|
||||
cygconfig.h
|
||||
depcomp
|
||||
install-sh
|
||||
libtool
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ When contributing to the Mono project, please follow the [Mono Coding
|
||||
Guidelines][1]. We have been using a coding style for many years,
|
||||
please make your patches conform to these guidelines.
|
||||
|
||||
[1] http://www.mono-project.com/Coding_Guidelines
|
||||
[1] http://www.mono-project.com/community/contributing/coding-guidelines/
|
||||
|
||||
Etiquette
|
||||
=========
|
||||
@@ -68,7 +68,7 @@ status of your pull request. If it succeeded and we like the changes,
|
||||
a maintainer will likely merge it. Otherwise, you can amend your pull
|
||||
request to fix build breakage and Jenkins will test it again.
|
||||
|
||||
[2] http://monojenkins.cloudapp.net
|
||||
[2] http://jenkins.mono-project.com/
|
||||
|
||||
# Inactivity
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-li
|
||||
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
|
||||
pic_options='-fPIC'
|
||||
;;
|
||||
?86-pc-cygwin*|i?86-pc-cygwin*)
|
||||
?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
|
||||
pic_options='-DDLL_EXPORT'
|
||||
;;
|
||||
i?86-apple-darwin*|arm-apple-darwin*)
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#
|
||||
# Appveyor configuration file for CI build of Mono on Windows (under Cygwin)
|
||||
#
|
||||
# For further details see http://www.appveyor.com
|
||||
#
|
||||
|
||||
# Use 'unstable' Appveyor build worker image as Appveyor have added Cygwin to this for us
|
||||
os: Unstable
|
||||
|
||||
#
|
||||
# Custom environment variables
|
||||
#
|
||||
environment:
|
||||
global:
|
||||
CYG_ROOT: C:/cygwin
|
||||
CYG_MIRROR: http://cygwin.mirror.constant.com
|
||||
CYG_CACHE: C:/cygwin/var/cache/setup
|
||||
NSIS_ROOT: C:\nsis
|
||||
|
||||
#
|
||||
# Initialisation prior to pulling the Mono repository
|
||||
#
|
||||
init:
|
||||
- 'echo Building Mono for Windows'
|
||||
- 'echo System architecture: %PLATFORM%'
|
||||
- 'echo Repo build branch is: %APPVEYOR_REPO_BRANCH%'
|
||||
- 'echo Build folder is: %APPVEYOR_BUILD_FOLDER%'
|
||||
# Attempt to ensure we don't try to convert line endings to Win32 CRLF as this will cause build to fail
|
||||
- 'git config --global core.autocrlf input'
|
||||
|
||||
#
|
||||
# Install needed build dependencies
|
||||
#
|
||||
install:
|
||||
# NOTE: Already installed on current Appveyor unstable image
|
||||
# - 'echo Retrieving Cygwin'
|
||||
# - 'appveyor DownloadFile http://cygwin.com/setup-x86.exe -FileName %CYGROOT%/setup-x86.exe'
|
||||
- 'echo Setting up Cygwin dependencies'
|
||||
- '%CYG_ROOT%\setup-x86.exe -qnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P autoconf -P automake -P bison -P gcc-core -P gcc-g++ -P mingw-runtime -P mingw-binutils -P mingw-gcc-core -P mingw-gcc-g++ -P mingw-pthreads -P mingw-w32api -P libtool -P make -P python -P gettext-devel -P gettext -P intltool -P libiconv -P pkg-config -P git -P wget -P curl > NUL'
|
||||
- 'echo Check Cygwin setup'
|
||||
- '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin"'
|
||||
- 'echo Done setting up Cygwin'
|
||||
- 'echo Retrieving NSIS'
|
||||
- 'appveyor DownloadFile "http://sunet.dl.sourceforge.net/project/nsis/NSIS 2/2.46/nsis-2.46-setup.exe" -FileName nsissetup.exe'
|
||||
- 'echo Setting up NSIS'
|
||||
- 'nsissetup.exe /S /D=%NSIS_ROOT%'
|
||||
- 'echo Done setting up NSIS'
|
||||
|
||||
#
|
||||
# NOTE: msbuild doesn't work at present so use Cygwin to build
|
||||
#
|
||||
#build:
|
||||
# project: C:\projects\mono\msvc\mono.sln
|
||||
# verbosity: detailed
|
||||
|
||||
# Cygwin build script
|
||||
#
|
||||
# NOTES:
|
||||
#
|
||||
# The stdin/stdout file descriptor appears not to be valid for the Appveyor
|
||||
# build which causes failures as certain functions attempt to redirect
|
||||
# default file handles. Ensure a dummy file descriptor is opened with exec.
|
||||
#
|
||||
build_script:
|
||||
- cmd: 'echo Cygwin root is: %CYG_ROOT%'
|
||||
- cmd: 'echo Build folder is: %APPVEYOR_BUILD_FOLDER%'
|
||||
- cmd: 'echo Repo build branch is: %APPVEYOR_REPO_BRANCH%'
|
||||
- cmd: 'echo Repo build commit is: %APPVEYOR_REPO_COMMIT%'
|
||||
- cmd: 'echo Autogen running...'
|
||||
- cmd: '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; NOCONFIGURE=1 ./autogen.sh --prefix=/usr/local --with-preview=yes"'
|
||||
- cmd: 'echo Configure running...'
|
||||
- cmd: '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; ./configure --host=i686-pc-mingw32"'
|
||||
- cmd: 'echo Pulling monolite latest...'
|
||||
- cmd: '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; make get-monolite-latest"'
|
||||
- cmd: 'echo Make running...'
|
||||
- cmd: '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; make"'
|
||||
- cmd: 'echo Installing...'
|
||||
- cmd: 'mkdir %APPVEYOR_BUILD_FOLDER%\install'
|
||||
- cmd: '%CYG_ROOT%/bin/bash --login -lc "export CYGWIN=winsymlinks:native; mount \"$APPVEYOR_BUILD_FOLDER\install\" /usr/local; cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; make install; umount /usr/local"'
|
||||
# - cmd: 'echo Building package...'
|
||||
# - cmd: 'cd %APPVEYOR_BUILD_FOLDER%'
|
||||
# - cmd: '%NSIS_ROOT%\makensis /DMILESTONE=%APPVEYOR_REPO_BRANCH% /DSOURCE_INSTALL_DIR=%APPVEYOR_BUILD_FOLDER\install\*.* /DBUILDNUM=%APPVEYOR_BUILD_VERSION% monowiz.win32.nsi'
|
||||
# - cmd: 'Building distribution...'
|
||||
# - cmd: '%CYG_ROOT%/bin/bash -lc "export CYGWIN=winsymlinks:native; cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; make dist"'
|
||||
|
||||
#
|
||||
# Disable tests for now
|
||||
#
|
||||
test: off
|
||||
|
||||
#
|
||||
# NOTE: Currently this is the Mono installation tree. In future we will create an installation package artifact.
|
||||
# It has to be relative to the project path. Thus we have installed to within the build tree.
|
||||
#
|
||||
artifacts:
|
||||
- path: install
|
||||
name: mono-binaries
|
||||
type: zip
|
||||
+36
-39
@@ -1,7 +1,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#AC_PREREQ([2.62])
|
||||
|
||||
AC_INIT(mono, [3.10.1],
|
||||
AC_INIT(mono, [3.12.0],
|
||||
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
|
||||
|
||||
AC_CONFIG_SRCDIR([README.md])
|
||||
@@ -115,9 +115,9 @@ case "$host" in
|
||||
AC_DEFINE(MINGW_CROSS_COMPILE,1,[Cross-compiling using MinGW])
|
||||
fi
|
||||
HOST_CC="gcc"
|
||||
# Windows 2000 is required that includes Internet Explorer 5.01
|
||||
# Windows XP SP2 is required
|
||||
CPPFLAGS="$CPPFLAGS -DWINVER=0x0502 -D_WIN32_WINNT=0x0502 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DWIN32_THREADS -DFD_SETSIZE=1024"
|
||||
LDFLAGS="$LDFLAGS -lmswsock -lws2_32 -lole32 -loleaut32 -lpsapi -lversion -ladvapi32 -lwinmm -lkernel32"
|
||||
LDFLAGS="$LDFLAGS -lmswsock -lws2_32 -lole32 -loleaut32 -lpsapi -lversion -ladvapi32 -lwinmm -lkernel32 -liphlpapi"
|
||||
libmono_cflags="-mms-bitfields -mwindows"
|
||||
libmono_ldflags="-mms-bitfields -mwindows"
|
||||
libdl=
|
||||
@@ -767,7 +767,7 @@ DISABLED_FEATURES=none
|
||||
AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
|
||||
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, appdomains, verifier,
|
||||
reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, perfcounters, normalization, assembly_remapping, shared_perfcounters, remoting,
|
||||
security, sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
|
||||
security, sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying, shared_handles.],
|
||||
[
|
||||
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
|
||||
eval "mono_feature_disable_$feature='yes'"
|
||||
@@ -941,6 +941,11 @@ if test "x$mono_feature_disable_sgen_copying" = "xyes"; then
|
||||
AC_MSG_NOTICE([Disabled major=copying support in SGEN.])
|
||||
fi
|
||||
|
||||
if test "x$mono_feature_disable_shared_handles" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_SHARED_HANDLES, 1, [Disable inter-process shared handles])
|
||||
AC_SUBST(DISABLE_SHARED_HANDLES)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(executables, [ --disable-executables disable the build of the runtime executables], enable_executables=$enableval, enable_executables=yes)
|
||||
AM_CONDITIONAL(DISABLE_EXECUTABLES, test x$enable_executables = xno)
|
||||
|
||||
@@ -1194,7 +1199,7 @@ if test x$target_win32 = xno; then
|
||||
|
||||
AC_CHECK_HEADERS(execinfo.h)
|
||||
|
||||
AC_CHECK_HEADERS(sys/auxv.h)
|
||||
AC_CHECK_HEADERS(sys/auxv.h sys/resource.h)
|
||||
|
||||
AC_CHECK_FUNCS(getgrgid_r)
|
||||
AC_CHECK_FUNCS(getgrnam_r)
|
||||
@@ -1213,6 +1218,7 @@ if test x$target_win32 = xno; then
|
||||
AC_CHECK_FUNCS(dl_iterate_phdr)
|
||||
AC_CHECK_FUNCS(dladdr)
|
||||
AC_CHECK_FUNCS(sysconf)
|
||||
AC_CHECK_FUNCS(getrlimit)
|
||||
|
||||
AC_CHECK_FUNCS(sched_setaffinity)
|
||||
AC_CHECK_FUNCS(sched_getcpu)
|
||||
@@ -2282,6 +2288,7 @@ if test "x$ac_cv_have_dev_random" = "xno" \
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if inter-process shared handles are requested])
|
||||
# Same as --enable-minimal=shared_handles
|
||||
AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
|
||||
AC_MSG_RESULT($try_shared_handles)
|
||||
if test "x$try_shared_handles" != "xyes"; then
|
||||
@@ -2498,7 +2505,6 @@ AM_CONDITIONAL(LOADED_LLVM, [test x$enable_loadedllvm = xyes])
|
||||
TARGET="unknown"
|
||||
ACCESS_UNALIGNED="yes"
|
||||
|
||||
JIT_SUPPORTED=no
|
||||
LIBC="libc.so.6"
|
||||
INTL="libc.so.6"
|
||||
SQLITE="libsqlite.so.0"
|
||||
@@ -2519,7 +2525,6 @@ case "$host" in
|
||||
arch_target=mips;
|
||||
sgen_supported=true
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
|
||||
AC_MSG_CHECKING(for mips n32)
|
||||
AC_TRY_COMPILE([],[
|
||||
@@ -2537,7 +2542,6 @@ case "$host" in
|
||||
i*86-*-*)
|
||||
TARGET=X86;
|
||||
arch_target=x86;
|
||||
JIT_SUPPORTED=yes
|
||||
case $host_os in
|
||||
solaris*)
|
||||
LIBC="libc.so"
|
||||
@@ -2583,7 +2587,6 @@ case "$host" in
|
||||
x86_64-*-* | amd64-*-*)
|
||||
TARGET=AMD64;
|
||||
arch_target=amd64;
|
||||
JIT_SUPPORTED=yes
|
||||
if test "x$ac_cv_sizeof_void_p" = "x4"; then
|
||||
AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
|
||||
sizeof_register=8
|
||||
@@ -2615,7 +2618,6 @@ case "$host" in
|
||||
TARGET=IA64
|
||||
arch_target=ia64
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
LIBC="libc.so.6.1"
|
||||
INTL="libc.so.6.1"
|
||||
AC_CHECK_LIB(unwind, _U_dyn_register, [], [AC_MSG_ERROR(library libunwind not found)])
|
||||
@@ -2628,7 +2630,6 @@ case "$host" in
|
||||
TARGET=SPARC
|
||||
fi
|
||||
arch_target=sparc;
|
||||
JIT_SUPPORTED=yes
|
||||
ACCESS_UNALIGNED="no"
|
||||
case $host_os in
|
||||
linux*) ;;
|
||||
@@ -2661,7 +2662,6 @@ case "$host" in
|
||||
CPPFLAGS="$CPPFLAGS -D__mono_ppc__"
|
||||
fi
|
||||
arch_target=ppc;
|
||||
JIT_SUPPORTED=yes
|
||||
case $host_os in
|
||||
linux*|darwin*)
|
||||
sgen_supported=true
|
||||
@@ -2672,7 +2672,6 @@ case "$host" in
|
||||
TARGET=ARM;
|
||||
arch_target=arm;
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
|
||||
sgen_supported=true
|
||||
;;
|
||||
@@ -2680,7 +2679,6 @@ case "$host" in
|
||||
TARGET=ARM;
|
||||
arch_target=arm;
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
sgen_supported=true
|
||||
AOT_SUPPORTED="yes"
|
||||
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
|
||||
@@ -2690,7 +2688,6 @@ case "$host" in
|
||||
# TARGET=ARM;
|
||||
# arch_target=arm;
|
||||
# ACCESS_UNALIGNED="no"
|
||||
# JIT_SUPPORTED=yes
|
||||
# sgen_supported=true
|
||||
# AOT_SUPPORTED="no"
|
||||
# ;;
|
||||
@@ -2698,7 +2695,6 @@ case "$host" in
|
||||
# https://lkml.org/lkml/2012/7/15/133
|
||||
TARGET=ARM64
|
||||
arch_target=arm64
|
||||
JIT_SUPPORTED=yes
|
||||
sgen_supported=true
|
||||
boehm_supported=false
|
||||
;;
|
||||
@@ -2706,7 +2702,6 @@ case "$host" in
|
||||
TARGET=S390X;
|
||||
arch_target=s390x;
|
||||
ACCESS_UNALIGNED="yes"
|
||||
JIT_SUPPORTED=yes
|
||||
sgen_supported=true
|
||||
CFLAGS="$CFLAGS -mbackchain -D__USE_STRING_INLINES"
|
||||
;;
|
||||
@@ -2722,9 +2717,7 @@ if test "x$host" != "x$target"; then
|
||||
TARGET=ARM;
|
||||
arch_target=arm;
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
|
||||
jit_wanted=true
|
||||
# Can't use tls, since it depends on the runtime detection of tls offsets
|
||||
# in mono-compiler.h
|
||||
with_tls=pthread
|
||||
@@ -2762,7 +2755,6 @@ if test "x$host" != "x$target"; then
|
||||
# arch_target=arm
|
||||
# AC_DEFINE(TARGET_ARM, 1, [...])
|
||||
# ACCESS_UNALIGNED="no"
|
||||
# JIT_SUPPORTED=yes
|
||||
# sizeof_register=4
|
||||
# CPPFLAGS="$CPPFLAGS \
|
||||
# -D__ARM_EABI__ \
|
||||
@@ -2772,7 +2764,6 @@ if test "x$host" != "x$target"; then
|
||||
# -DDISABLE_SOCKETS \
|
||||
# -DDISABLE_ATTACH \
|
||||
# -DUSE_NEWLIB"
|
||||
# jit_wanted=true
|
||||
# Can't use tls, since it depends on the runtime detection of tls offsets
|
||||
# in mono-compiler.h
|
||||
# with_tls=pthread
|
||||
@@ -2789,9 +2780,7 @@ if test "x$host" != "x$target"; then
|
||||
AC_DEFINE(TARGET_ARM, 1, [...])
|
||||
AC_DEFINE(TARGET_ANDROID, 1, [...])
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
|
||||
jit_wanted=true
|
||||
# Can't use tls, since it depends on the runtime detection of tls offsets
|
||||
# in mono-compiler.h
|
||||
with_tls=pthread
|
||||
@@ -2806,10 +2795,31 @@ if test "x$host" != "x$target"; then
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
i686*-linux-*)
|
||||
TARGET=X86;
|
||||
arch_target=x86;
|
||||
AC_DEFINE(TARGET_X86, 1, [...])
|
||||
AC_DEFINE(TARGET_ANDROID, 1, [...])
|
||||
CPPFLAGS="$CPPFLAGS"
|
||||
sgen_supported=true
|
||||
# Can't use tls, since it depends on the runtime detection of tls offsets
|
||||
# in mono-compiler.h
|
||||
with_tls=pthread
|
||||
target_mach=no
|
||||
;;
|
||||
aarch64*-linux-*)
|
||||
TARGET=ARM64;
|
||||
arch_target=arm64;
|
||||
AC_DEFINE(TARGET_ARM64, 1, [...])
|
||||
AC_DEFINE(TARGET_ANDROID, 1, [...])
|
||||
CPPFLAGS="$CPPFLAGS"
|
||||
# Can't use tls, since it depends on the runtime detection of tls offsets
|
||||
# in mono-compiler.h
|
||||
with_tls=pthread
|
||||
target_mach=no
|
||||
;;
|
||||
aarch64-*)
|
||||
TARGET=ARM64
|
||||
JIT_SUPPORTED=yes
|
||||
jit_wanted=true
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Cross compiling is not supported for target $target])
|
||||
@@ -2932,19 +2942,7 @@ fi
|
||||
AC_SUBST(SGEN_DEFINES)
|
||||
AM_CONDITIONAL(SUPPORT_SGEN, test x$buildsgen = xyes)
|
||||
|
||||
USEJIT=false
|
||||
if test x$JIT_SUPPORTED = xyes; then
|
||||
if $jit_wanted; then
|
||||
USEJIT=true
|
||||
jit_status="Building and using the JIT"
|
||||
else
|
||||
AC_ERROR(No JIT support available or selected.)
|
||||
fi
|
||||
else
|
||||
AC_ERROR(No JIT support available or selected.)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(USE_JIT, test x$USEJIT = xtrue)
|
||||
jit_status="Building and using the JIT"
|
||||
|
||||
libsuffix=".so"
|
||||
|
||||
@@ -3347,7 +3345,6 @@ AM_CONDITIONAL(HOST_ARM, test x$HOST = xARM)
|
||||
AM_CONDITIONAL(HOST_ARM64, test x$HOST = xARM64)
|
||||
AM_CONDITIONAL(CROSS_COMPILE, test "x$host" != "x$target")
|
||||
|
||||
AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
|
||||
AM_CONDITIONAL(INCLUDED_LIBGC, test x$libgc = xincluded)
|
||||
|
||||
AC_SUBST(LIBC)
|
||||
|
||||
@@ -26,12 +26,8 @@ else
|
||||
SGENPCFILE=
|
||||
endif
|
||||
|
||||
if JIT_SUPPORTED
|
||||
pkgconfig_DATA= mono.pc mono-2.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc xbuild12.pc $(SGENPCFILE)
|
||||
else
|
||||
pkgconfig_DATA= mint.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc
|
||||
endif
|
||||
|
||||
DISTCLEANFILES= mono-2.pc mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc $(SGENPCFILE) mono-sgen-gdb.py
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-li
|
||||
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
|
||||
pic_options='-fPIC'
|
||||
;;
|
||||
?86-pc-cygwin*|i?86-pc-cygwin*)
|
||||
?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
|
||||
pic_options='-DDLL_EXPORT'
|
||||
;;
|
||||
i?86-apple-darwin*|arm-apple-darwin*)
|
||||
|
||||
+2
-1
@@ -135,6 +135,7 @@ AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
|
||||
AC_CHECK_FUNCS(getrlimit)
|
||||
|
||||
#
|
||||
# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
|
||||
@@ -179,7 +180,7 @@ if test "x$have_iso_varargs" = "xyes"; then
|
||||
fi
|
||||
AC_SUBST(G_HAVE_ISO_VARARGS)
|
||||
|
||||
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
|
||||
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h)
|
||||
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
|
||||
AC_SUBST(HAVE_ALLOCA_H)
|
||||
|
||||
|
||||
@@ -176,7 +176,6 @@ typedef struct _GMemChunk GMemChunk;
|
||||
/*
|
||||
* Misc.
|
||||
*/
|
||||
#define g_atexit(func) ((void) atexit (func))
|
||||
|
||||
const gchar * g_getenv(const gchar *variable);
|
||||
gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
|
||||
|
||||
+23
-2
@@ -53,6 +53,10 @@
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <io.h>
|
||||
#include <winsock2.h>
|
||||
@@ -213,6 +217,23 @@ write_all (int fd, const void *vbuf, size_t n)
|
||||
return nwritten;
|
||||
}
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
static int
|
||||
g_getdtablesize (void)
|
||||
{
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
struct rlimit limit;
|
||||
int res;
|
||||
|
||||
res = getrlimit (RLIMIT_NOFILE, &limit);
|
||||
g_assert (res == 0);
|
||||
return limit.rlim_cur;
|
||||
#else
|
||||
return getdtablesize ();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
g_spawn_command_line_sync (const gchar *command_line,
|
||||
gchar **standard_output,
|
||||
@@ -256,7 +277,7 @@ g_spawn_command_line_sync (const gchar *command_line,
|
||||
close (stderr_pipe [0]);
|
||||
dup2 (stderr_pipe [1], STDERR_FILENO);
|
||||
}
|
||||
for (i = getdtablesize () - 1; i >= 3; i--)
|
||||
for (i = g_getdtablesize () - 1; i >= 3; i--)
|
||||
close (i);
|
||||
|
||||
/* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
|
||||
@@ -417,7 +438,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
}
|
||||
|
||||
if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
|
||||
for (i = getdtablesize () - 1; i >= 3; i--)
|
||||
for (i = g_getdtablesize () - 1; i >= 3; i--)
|
||||
close (i);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/* config.h. Generated by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include "cygconfig.h"
|
||||
#else
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
@@ -74,3 +78,4 @@
|
||||
#define VERSION "0.1"
|
||||
|
||||
#define HAVE_STRTOK_R 1
|
||||
#endif
|
||||
+1
-1
@@ -26,7 +26,7 @@ i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-li
|
||||
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
|
||||
pic_options='-fPIC'
|
||||
;;
|
||||
?86-pc-cygwin*|i?86-pc-cygwin*)
|
||||
?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
|
||||
pic_options='-DDLL_EXPORT'
|
||||
;;
|
||||
i?86-apple-darwin*|arm-apple-darwin*)
|
||||
|
||||
+9
-13
@@ -1075,19 +1075,10 @@ first generation (of two). A larger nursery will usually speed up the
|
||||
program but will obviously use more memory. The default nursery size
|
||||
4 MB.
|
||||
.TP
|
||||
\fBmajor=\fIcollector\fR
|
||||
Specifies which major collector to use. Options are `marksweep' for
|
||||
the Mark&Sweep collector, `marksweep-conc' for concurrent Mark&Sweep,
|
||||
`marksweep-par' for parallel Mark&Sweep, `marksweep-fixed' for
|
||||
Mark&Sweep with a fixed heap, and `marksweep-fixed-par' for parallel
|
||||
Mark&Sweep with a fixed heap. The Mark&Sweep collector is the default.
|
||||
.TP
|
||||
\fBmajor-heap-size=\fIsize\fR
|
||||
Sets the size of the major heap (not including the large object space)
|
||||
for the fixed-heap Mark&Sweep collector (i.e. `marksweep-fixed' and
|
||||
`marksweep-fixed-par'). The size is in bytes, with optional suffixes
|
||||
`k', `m' and `g' to specify kilo-, mega- and gigabytes, respectively.
|
||||
The default is 512 megabytes.
|
||||
\fBmajor=\fIcollector\fR Specifies which major collector to use.
|
||||
Options are `marksweep' for the Mark&Sweep collector, and
|
||||
`marksweep-conc' for concurrent Mark&Sweep. The non-concurrent
|
||||
Mark&Sweep collector is the default.
|
||||
.TP
|
||||
\fBsoft-heap-limit=\fIsize\fR
|
||||
Once the heap size gets larger than this size, ignore what the default
|
||||
@@ -1266,6 +1257,11 @@ work, Mono needs to be compiled with the BINARY_PROTOCOL define on
|
||||
sgen-gc.c. You can then use this command to explore the output
|
||||
.nf
|
||||
sgen-grep-binprot 0x1234 0x5678 < file
|
||||
.TP
|
||||
\fBnursery-canaries\fR
|
||||
If set, objects allocated in the nursery are suffixed with a canary (guard)
|
||||
word, which is checked on each minor collection. Can be used to detect/debug
|
||||
heap corruption issues.
|
||||
.fi
|
||||
.ne
|
||||
.RE
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
|
||||
public RelaxngPattern Parse (TextReader source, string baseUri, string defaultNamespace)
|
||||
{
|
||||
this.defaultNamespace = defaultNamespace;
|
||||
this.defaultNamespace = defaultNamespace ?? string.Empty;
|
||||
if (defaultNamespace != null && defaultNamespace.Length != 0)
|
||||
nsmgr.AddNamespace (String.Empty, defaultNamespace);
|
||||
try {
|
||||
|
||||
@@ -95,5 +95,19 @@ start = mine";
|
||||
r.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SimpleDefaultNamespace ()
|
||||
{
|
||||
var g = RncParser.ParseRnc (new StringReader ("element e { empty }"));
|
||||
var x = XmlReader.Create (new StringReader ("<e/>"));
|
||||
var r = new RelaxngValidatingReader (x, g);
|
||||
try {
|
||||
while (!r.EOF)
|
||||
r.Read ();
|
||||
} finally {
|
||||
r.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ TEST_ARCHIVE = testSuite.zip
|
||||
RNCTESTS = test/RNCTest.xml
|
||||
RNCTEST_ARCHIVE = anglia-test-suite.zip
|
||||
|
||||
all : relaxngtest.exe anglia-test-runner.exe
|
||||
all : relaxngtest.exe #anglia-test-runner.exe
|
||||
|
||||
relaxngtest.exe : relaxngtest.cs $(TESTS)
|
||||
$(MCS_RUNTIME) $(MCS) -debug+ relaxngtest.cs -r:Commons.Xml.Relaxng.dll
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.COMException))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComMemberType))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComSourceInterfacesAttribute))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComInterfaceType))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IStream))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.STATSTG))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CriticalHandle))]
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace System.Windows.Forms {
|
||||
Rectangle text_rectangle;
|
||||
Rectangle image_rectangle;
|
||||
|
||||
ThemeEngine.Current.CalculateButtonTextAndImageLayout (this, out text_rectangle, out image_rectangle);
|
||||
ThemeEngine.Current.CalculateButtonTextAndImageLayout (pevent.Graphics, this, out text_rectangle, out image_rectangle);
|
||||
|
||||
// Draw our button
|
||||
if (this.FlatStyle == FlatStyle.Standard)
|
||||
|
||||
@@ -258,11 +258,19 @@ namespace System.Windows.Forms
|
||||
StringFormat sf = FlagsToStringFormat (flags);
|
||||
|
||||
Size retval;
|
||||
|
||||
|
||||
int proposedWidth;
|
||||
if (proposedSize.Width == 0)
|
||||
proposedWidth = Int32.MaxValue;
|
||||
else {
|
||||
proposedWidth = proposedSize.Width;
|
||||
if ((flags & TextFormatFlags.NoPadding) == 0)
|
||||
proposedWidth -= 9;
|
||||
}
|
||||
if (dc is Graphics)
|
||||
retval = (dc as Graphics).MeasureString (text, font, proposedSize.Width == 0 ? Int32.MaxValue : proposedSize.Width, sf).ToSize ();
|
||||
retval = (dc as Graphics).MeasureString (text, font, proposedWidth, sf).ToSize ();
|
||||
else
|
||||
retval = TextRenderer.MeasureString (text, font, proposedSize.Width == 0 ? Int32.MaxValue : proposedSize.Width, sf).ToSize ();
|
||||
retval = TextRenderer.MeasureString (text, font, proposedWidth, sf).ToSize ();
|
||||
|
||||
if (retval.Width > 0 && (flags & TextFormatFlags.NoPadding) == 0)
|
||||
retval.Width += 9;
|
||||
|
||||
@@ -698,7 +698,7 @@ namespace System.Windows.Forms
|
||||
|
||||
#region Button
|
||||
public abstract Size CalculateButtonAutoSize (Button button);
|
||||
public abstract void CalculateButtonTextAndImageLayout (ButtonBase b, out Rectangle textRectangle, out Rectangle imageRectangle);
|
||||
public abstract void CalculateButtonTextAndImageLayout (Graphics g, ButtonBase b, out Rectangle textRectangle, out Rectangle imageRectangle);
|
||||
public abstract void DrawButton (Graphics g, Button b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle);
|
||||
public abstract void DrawFlatButton (Graphics g, ButtonBase b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle);
|
||||
public abstract void DrawPopupButton (Graphics g, Button b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle);
|
||||
|
||||
@@ -364,24 +364,23 @@ namespace System.Windows.Forms
|
||||
return ret_size;
|
||||
}
|
||||
|
||||
public override void CalculateButtonTextAndImageLayout (ButtonBase button, out Rectangle textRectangle, out Rectangle imageRectangle)
|
||||
public override void CalculateButtonTextAndImageLayout (Graphics g, ButtonBase button, out Rectangle textRectangle, out Rectangle imageRectangle)
|
||||
{
|
||||
Image image = button.Image;
|
||||
string text = button.Text;
|
||||
Rectangle content_rect = button.PaddingClientRectangle;
|
||||
Size text_size = TextRenderer.MeasureTextInternal (text, button.Font, content_rect.Size, button.TextFormatFlags, button.UseCompatibleTextRendering);
|
||||
Size text_size = TextRenderer.MeasureTextInternal (g, text, button.Font, content_rect.Size, button.TextFormatFlags | TextFormatFlags.NoPadding, button.UseCompatibleTextRendering);
|
||||
Size image_size = image == null ? Size.Empty : image.Size;
|
||||
|
||||
textRectangle = Rectangle.Empty;
|
||||
textRectangle = Rectangle.Inflate (content_rect, -4, -4);
|
||||
imageRectangle = Rectangle.Empty;
|
||||
|
||||
switch (button.TextImageRelation) {
|
||||
case TextImageRelation.Overlay:
|
||||
// Overlay is easy, text always goes here
|
||||
textRectangle = Rectangle.Inflate (content_rect, -4, -4);
|
||||
|
||||
if (button.Pressed)
|
||||
textRectangle.Offset (1, 1);
|
||||
if (button.Pressed)
|
||||
textRectangle.Offset (1, 1);
|
||||
|
||||
// Image is dependent on ImageAlign
|
||||
if (image == null)
|
||||
@@ -438,20 +437,16 @@ namespace System.Windows.Forms
|
||||
imageRectangle = new Rectangle (image_x, image_y, image_width, image_height);
|
||||
break;
|
||||
case TextImageRelation.ImageAboveText:
|
||||
content_rect.Inflate (-4, -4);
|
||||
LayoutTextAboveOrBelowImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.TextAboveImage:
|
||||
content_rect.Inflate (-4, -4);
|
||||
LayoutTextAboveOrBelowImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.ImageBeforeText:
|
||||
content_rect.Inflate (-4, -4);
|
||||
LayoutTextBeforeOrAfterImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
LayoutTextBeforeOrAfterImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.TextBeforeImage:
|
||||
content_rect.Inflate (-4, -4);
|
||||
LayoutTextBeforeOrAfterImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
LayoutTextBeforeOrAfterImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -537,12 +532,14 @@ namespace System.Windows.Forms
|
||||
offset += (int)(2 * (excess_height / 3));
|
||||
|
||||
if (textFirst) {
|
||||
final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, totalArea.Top + offset, textSize.Width, textSize.Height);
|
||||
var textHeight = excess_height >= 0 ? totalArea.Height - imageSize.Height - element_spacing: textSize.Height;
|
||||
final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, totalArea.Top + offset, textSize.Width, textHeight);
|
||||
final_image_rect = new Rectangle (AlignInRectangle (totalArea, imageSize, imageAlign).Left, final_text_rect.Bottom + element_spacing, imageSize.Width, imageSize.Height);
|
||||
}
|
||||
else {
|
||||
final_image_rect = new Rectangle (AlignInRectangle (totalArea, imageSize, imageAlign).Left, totalArea.Top + offset, imageSize.Width, imageSize.Height);
|
||||
final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, final_image_rect.Bottom + element_spacing, textSize.Width, textSize.Height);
|
||||
var textHeight = excess_height >= 0 ? totalArea.Height - final_image_rect.Height : textSize.Height;
|
||||
final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, final_image_rect.Bottom + element_spacing, textSize.Width, textHeight);
|
||||
|
||||
if (final_text_rect.Bottom > totalArea.Bottom)
|
||||
final_text_rect.Y = totalArea.Top;
|
||||
|
||||
@@ -1296,7 +1296,7 @@ namespace System.Windows.Forms {
|
||||
buffer [i] = Marshal.ReadByte (prop, i);
|
||||
Clipboard.Item = Encoding.UTF8.GetString (buffer);
|
||||
} else if (property == UTF16_STRING) {
|
||||
Clipboard.Item = Marshal.PtrToStringUni (prop, Encoding.Unicode.GetMaxCharCount ((int)nitems));
|
||||
Clipboard.Item = Marshal.PtrToStringUni (prop);
|
||||
} else if (property == RICHTEXTFORMAT)
|
||||
Clipboard.Item = Marshal.PtrToStringAnsi(prop);
|
||||
else if (DataFormats.ContainsFormat (property.ToInt32 ())) {
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
<Compile Include="Microsoft.Build.BuildEngine\TaskBatchingImpl.cs" />
|
||||
<Compile Include="Microsoft.Build.BuildEngine\TaskDatabase.cs" />
|
||||
<Compile Include="Microsoft.Build.BuildEngine\TaskEngine.cs" />
|
||||
<Compile Include="Microsoft.Build.BuildEngine\TaskExecutionMode.cs" />
|
||||
<Compile Include="Microsoft.Build.BuildEngine\Token.cs" />
|
||||
<Compile Include="Microsoft.Build.BuildEngine\Toolset.cs" />
|
||||
<Compile Include="Microsoft.Build.BuildEngine\ToolsetCollection.cs" />
|
||||
|
||||
@@ -41,7 +41,9 @@ using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Sockets;
|
||||
using System.Globalization;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Mono.Data.Tds.Protocol
|
||||
{
|
||||
@@ -1468,7 +1470,7 @@ namespace Mono.Data.Tds.Protocol
|
||||
t3.Domain = this.connectionParms.DefaultDomain;
|
||||
t3.Host = this.connectionParms.Hostname;
|
||||
t3.Username = this.connectionParms.User;
|
||||
t3.Password = this.connectionParms.Password;
|
||||
t3.Password = GetPlainPassword(this.connectionParms.Password);
|
||||
|
||||
Comm.StartPacket (TdsPacketType.SspAuth); // 0x11
|
||||
Comm.Append (t3.GetBytes ());
|
||||
@@ -1919,6 +1921,20 @@ namespace Mono.Data.Tds.Protocol
|
||||
comm.Skip(4);
|
||||
}
|
||||
|
||||
public static string GetPlainPassword(SecureString secPass)
|
||||
{
|
||||
IntPtr plainString = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
plainString = Marshal.SecureStringToGlobalAllocUnicode(secPass);
|
||||
return Marshal.PtrToStringUni(plainString);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.ZeroFreeGlobalAllocUnicode(plainString);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Private Methods
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Security;
|
||||
|
||||
namespace Mono.Data.Tds.Protocol {
|
||||
public sealed class Tds42 : Tds
|
||||
@@ -77,7 +78,7 @@ namespace Mono.Data.Tds.Protocol {
|
||||
Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
|
||||
|
||||
// password (offset 62 0x3e)
|
||||
tmp = Comm.Append (connectionParameters.Password, 30, pad);
|
||||
tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 30, pad);
|
||||
Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
|
||||
|
||||
// hostproc (offset 93 0x5d)
|
||||
@@ -145,7 +146,7 @@ namespace Mono.Data.Tds.Protocol {
|
||||
|
||||
// remote passwords
|
||||
Comm.Append (empty, 2, pad);
|
||||
tmp = Comm.Append (connectionParameters.Password, 253, pad);
|
||||
tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 253, pad);
|
||||
Comm.Append ((byte) (tmp.Length < 253 ? tmp.Length + 2 : 253 + 2));
|
||||
|
||||
// tds version
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
using Mono.Data.Tds;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Security;
|
||||
|
||||
namespace Mono.Data.Tds.Protocol
|
||||
{
|
||||
@@ -118,7 +119,7 @@ namespace Mono.Data.Tds.Protocol
|
||||
|
||||
// password (offset 62 0x3e)
|
||||
// 62-92
|
||||
tmp = Comm.Append (connectionParameters.Password, 30, pad);
|
||||
tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 30, pad);
|
||||
Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
|
||||
|
||||
// hostproc (offset 93 0x5d)
|
||||
@@ -187,7 +188,7 @@ namespace Mono.Data.Tds.Protocol
|
||||
// remote passwords
|
||||
// 202-457
|
||||
Comm.Append (empty, 2, pad);
|
||||
tmp = Comm.Append (connectionParameters.Password, 253, pad);
|
||||
tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 253, pad);
|
||||
Comm.Append ((byte) (tmp.Length < 253 ? tmp.Length + 2 : 253 + 2));
|
||||
|
||||
// tds version
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Security;
|
||||
|
||||
using Mono.Security.Protocol.Ntlm;
|
||||
|
||||
@@ -392,11 +393,12 @@ namespace Mono.Data.Tds.Protocol
|
||||
return IsConnected;
|
||||
}
|
||||
|
||||
private static string EncryptPassword (string pass)
|
||||
private static string EncryptPassword (SecureString secPass)
|
||||
{
|
||||
int xormask = 0x5a5a;
|
||||
int len = pass.Length;
|
||||
int len = secPass.Length;
|
||||
char[] chars = new char[len];
|
||||
string pass = GetPlainPassword(secPass);
|
||||
|
||||
for (int i = 0; i < len; ++i) {
|
||||
int c = ((int) (pass[i])) ^ xormask;
|
||||
@@ -487,6 +489,19 @@ namespace Mono.Data.Tds.Protocol
|
||||
|
||||
Comm.Append ((byte) 0x00); // no param meta data name
|
||||
Comm.Append ((byte) 0x00); // no status flags
|
||||
|
||||
// Convert BigNVarChar values larger than 4000 chars to nvarchar(max)
|
||||
// Need to do this here so WritePreparedParameterInfo emit the
|
||||
// correct data type
|
||||
foreach (TdsMetaParameter param2 in parameters) {
|
||||
var colType = param2.GetMetaType ();
|
||||
|
||||
if (colType == TdsColumnType.BigNVarChar) {
|
||||
int size = param2.GetActualSize ();
|
||||
if ((size >> 1) > 4000)
|
||||
param2.Size = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Write sql as a parameter value - UCS2
|
||||
TdsMetaParameter param = new TdsMetaParameter ("sql",
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Security;
|
||||
|
||||
namespace Mono.Data.Tds.Protocol
|
||||
{
|
||||
@@ -42,7 +43,8 @@ namespace Mono.Data.Tds.Protocol
|
||||
public string Hostname;
|
||||
public string Language;
|
||||
public string LibraryName;
|
||||
public string Password;
|
||||
public SecureString Password;
|
||||
public bool PasswordSet;
|
||||
public string ProgName;
|
||||
public string User;
|
||||
public bool DomainLogin;
|
||||
@@ -62,7 +64,8 @@ namespace Mono.Data.Tds.Protocol
|
||||
Hostname = System.Net.Dns.GetHostName();
|
||||
Language = String.Empty;
|
||||
LibraryName = "Mono";
|
||||
Password = String.Empty;
|
||||
Password = new SecureString();
|
||||
PasswordSet = false;
|
||||
ProgName = "Mono";
|
||||
User = String.Empty;
|
||||
DomainLogin = false;
|
||||
|
||||
@@ -155,11 +155,12 @@ namespace Mono.Debugger.Soft
|
||||
|
||||
[Flags]
|
||||
enum InvokeFlags {
|
||||
NONE = 0x0,
|
||||
DISABLE_BREAKPOINTS = 0x1,
|
||||
SINGLE_THREADED = 0x2,
|
||||
OUT_THIS = 0x4,
|
||||
OUT_ARGS = 0x8,
|
||||
NONE = 0,
|
||||
DISABLE_BREAKPOINTS = 1,
|
||||
SINGLE_THREADED = 2,
|
||||
OUT_THIS = 4,
|
||||
OUT_ARGS = 8,
|
||||
VIRTUAL = 16,
|
||||
}
|
||||
|
||||
enum ElementType {
|
||||
@@ -416,7 +417,7 @@ namespace Mono.Debugger.Soft
|
||||
* with newer runtimes, and vice versa.
|
||||
*/
|
||||
internal const int MAJOR_VERSION = 2;
|
||||
internal const int MINOR_VERSION = 35;
|
||||
internal const int MINOR_VERSION = 38;
|
||||
|
||||
enum WPSuspendPolicy {
|
||||
NONE = 0,
|
||||
@@ -584,7 +585,8 @@ namespace Mono.Debugger.Soft
|
||||
enum CmdStackFrame {
|
||||
GET_VALUES = 1,
|
||||
GET_THIS = 2,
|
||||
SET_VALUES = 3
|
||||
SET_VALUES = 3,
|
||||
GET_DOMAIN = 4,
|
||||
}
|
||||
|
||||
enum CmdArrayRef {
|
||||
@@ -2377,6 +2379,10 @@ namespace Mono.Debugger.Soft
|
||||
SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.SET_VALUES, new PacketWriter ().WriteId (thread_id).WriteId (id).WriteInt (len).WriteInts (pos).WriteValues (values));
|
||||
}
|
||||
|
||||
internal long StackFrame_GetDomain (long thread_id, long id) {
|
||||
return SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.GET_DOMAIN, new PacketWriter ().WriteId (thread_id).WriteId (id)).ReadId ();
|
||||
}
|
||||
|
||||
/*
|
||||
* ARRAYS
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,11 @@ namespace Mono.Debugger.Soft
|
||||
/*
|
||||
* Return the values of out arguments
|
||||
*/
|
||||
ReturnOutArgs = 8
|
||||
ReturnOutArgs = 8,
|
||||
/*
|
||||
* Do a virtual invoke
|
||||
* Since protocol version 2.37
|
||||
*/
|
||||
Virtual = 16
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,8 @@ namespace Mono.Debugger.Soft
|
||||
f |= InvokeFlags.OUT_THIS;
|
||||
if ((options & InvokeOptions.ReturnOutArgs) != 0)
|
||||
f |= InvokeFlags.OUT_ARGS;
|
||||
if ((options & InvokeOptions.Virtual) != 0)
|
||||
f |= InvokeFlags.VIRTUAL;
|
||||
|
||||
InvokeAsyncResult r = new InvokeAsyncResult { AsyncState = state, AsyncWaitHandle = new ManualResetEvent (false), VM = vm, Thread = thread, Callback = callback };
|
||||
thread.InvalidateFrames ();
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Mono.Debugger.Soft
|
||||
public class StackFrame : Mirror
|
||||
{
|
||||
ThreadMirror thread;
|
||||
AppDomainMirror domain;
|
||||
MethodMirror method;
|
||||
int il_offset;
|
||||
Location location;
|
||||
@@ -32,6 +33,16 @@ namespace Mono.Debugger.Soft
|
||||
}
|
||||
}
|
||||
|
||||
public AppDomainMirror Domain {
|
||||
get {
|
||||
vm.CheckProtocolVersion (2, 38);
|
||||
if (domain == null)
|
||||
domain = vm.GetDomain (vm.conn.StackFrame_GetDomain (thread.Id, Id));
|
||||
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
|
||||
public MethodMirror Method {
|
||||
get {
|
||||
return method;
|
||||
|
||||
@@ -22,6 +22,10 @@ public class TestsBase
|
||||
static string base_static_s = "C";
|
||||
#pragma warning restore 0414
|
||||
#pragma warning restore 0169
|
||||
|
||||
public virtual string virtual_method () {
|
||||
return "V1";
|
||||
}
|
||||
}
|
||||
|
||||
public enum AnEnum {
|
||||
@@ -1365,6 +1369,10 @@ public class Tests : TestsBase, ITest2
|
||||
j = 5;
|
||||
set_ip_2 ();
|
||||
}
|
||||
|
||||
public override string virtual_method () {
|
||||
return "V2";
|
||||
}
|
||||
}
|
||||
|
||||
class TypeLoadClass {
|
||||
|
||||
@@ -2137,6 +2137,11 @@ public class DebuggerTests
|
||||
v = this_obj.InvokeMethod (e.Thread, m, null);
|
||||
AssertValue (42, v);
|
||||
|
||||
// virtual call
|
||||
m = t.BaseType.GetMethod ("virtual_method");
|
||||
v = this_obj.InvokeMethod (e.Thread, m, null, InvokeOptions.Virtual);
|
||||
AssertValue ("V2", v);
|
||||
|
||||
#if NET_4_5
|
||||
// instance
|
||||
m = t.GetMethod ("invoke_pass_ref");
|
||||
@@ -2864,8 +2869,10 @@ public class DebuggerTests
|
||||
|
||||
var frames = e.Thread.GetFrames ();
|
||||
Assert.AreEqual ("invoke_in_domain", frames [0].Method.Name);
|
||||
Assert.AreEqual (domain, frames [0].Domain);
|
||||
Assert.AreEqual ("invoke", frames [1].Method.Name);
|
||||
Assert.AreEqual ("domains", frames [2].Method.Name);
|
||||
Assert.AreEqual (vm.RootDomain, frames [2].Domain);
|
||||
|
||||
// Test breakpoints on already JITted methods in other domains
|
||||
m = entry_point.DeclaringType.GetMethod ("invoke_in_domain_2");
|
||||
|
||||
@@ -221,15 +221,13 @@ namespace Mono.Security.Cryptography {
|
||||
string msg = Locale.GetText ("Could not create user key store '{0}'.");
|
||||
throw new CryptographicException (String.Format (msg, _userPath), e);
|
||||
}
|
||||
|
||||
if (!ProtectUser (_userPath)) {
|
||||
string msg = Locale.GetText ("Could not secure user key store '{0}'.");
|
||||
throw new IOException (String.Format (msg, _userPath));
|
||||
}
|
||||
|
||||
_userPathExists = true;
|
||||
}
|
||||
}
|
||||
if (!IsUserProtected (_userPath) && !ProtectUser (_userPath)) {
|
||||
string msg = Locale.GetText ("Could not secure user key store '{0}'.");
|
||||
throw new IOException (String.Format (msg, _userPath));
|
||||
}
|
||||
}
|
||||
// is it properly protected ?
|
||||
if (!IsUserProtected (_userPath)) {
|
||||
@@ -258,15 +256,13 @@ namespace Mono.Security.Cryptography {
|
||||
string msg = Locale.GetText ("Could not create machine key store '{0}'.");
|
||||
throw new CryptographicException (String.Format (msg, _machinePath), e);
|
||||
}
|
||||
|
||||
if (!ProtectMachine (_machinePath)) {
|
||||
string msg = Locale.GetText ("Could not secure machine key store '{0}'.");
|
||||
throw new IOException (String.Format (msg, _machinePath));
|
||||
}
|
||||
|
||||
_machinePathExists = true;
|
||||
}
|
||||
}
|
||||
if (!IsMachineProtected (_machinePath) && !ProtectMachine (_machinePath)) {
|
||||
string msg = Locale.GetText ("Could not secure machine key store '{0}'.");
|
||||
throw new IOException (String.Format (msg, _machinePath));
|
||||
}
|
||||
}
|
||||
// is it properly protected ?
|
||||
if (!IsMachineProtected (_machinePath)) {
|
||||
|
||||
@@ -669,14 +669,24 @@ namespace Mono.Security.Protocol.Tls
|
||||
|
||||
#region Send Alert Methods
|
||||
|
||||
internal void SendAlert(ref Exception ex)
|
||||
{
|
||||
var tlsEx = ex as TlsException;
|
||||
var alert = tlsEx != null ? tlsEx.Alert : new Alert(AlertDescription.InternalError);
|
||||
|
||||
try {
|
||||
SendAlert(alert);
|
||||
} catch (Exception alertEx) {
|
||||
ex = new IOException (string.Format ("Error while sending TLS Alert ({0}:{1}): {2}", alert.Level, alert.Description, ex), ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendAlert(AlertDescription description)
|
||||
{
|
||||
this.SendAlert(new Alert(description));
|
||||
}
|
||||
|
||||
public void SendAlert(
|
||||
AlertLevel level,
|
||||
AlertDescription description)
|
||||
public void SendAlert(AlertLevel level, AlertDescription description)
|
||||
{
|
||||
this.SendAlert(new Alert(level, description));
|
||||
}
|
||||
@@ -699,8 +709,13 @@ namespace Mono.Security.Protocol.Tls
|
||||
close = alert.IsCloseNotify;
|
||||
}
|
||||
|
||||
try {
|
||||
// Write record
|
||||
this.SendRecord (ContentType.Alert, new byte[2] { (byte) level, (byte) description });
|
||||
this.SendRecord (ContentType.Alert, new byte[2] { (byte) level, (byte) description });
|
||||
} catch (Exception ex) {
|
||||
throw new IOException (string.Format (
|
||||
"Exception while sending TLS Alert ({0}:{1})", level, description), ex);
|
||||
}
|
||||
|
||||
if (close) {
|
||||
this.context.SentConnectionEnd = true;
|
||||
|
||||
@@ -588,14 +588,34 @@ namespace Mono.Security.Protocol.Tls
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
// FIXME: should the send alert also be done asynchronously here and below?
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
negotiate.SetComplete (new IOException("The authentication or decryption has failed.", ex));
|
||||
#if NET_4_0
|
||||
AggregateException aggregate;
|
||||
try {
|
||||
// FIXME: should the send alert also be done asynchronously here and below?
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
aggregate = new AggregateException ("The authentication or decryption has failed.", ex);
|
||||
} catch (Exception alertEx) {
|
||||
aggregate = new AggregateException ("The authentication or decryption has failed (error while sending Alert).", ex, alertEx);
|
||||
}
|
||||
#else
|
||||
var aggregate = new Exception ();
|
||||
#endif
|
||||
negotiate.SetComplete (aggregate);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
negotiate.SetComplete (new IOException("The authentication or decryption has failed.", ex));
|
||||
#if NET_4_0
|
||||
AggregateException aggregate;
|
||||
try {
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
aggregate = new AggregateException ("The authentication or decryption has failed.", ex);
|
||||
} catch (Exception alertEx) {
|
||||
aggregate = new AggregateException ("The authentication or decryption has failed (error while sending Alert).", ex, alertEx);
|
||||
}
|
||||
#else
|
||||
var aggregate = new Exception ();
|
||||
#endif
|
||||
negotiate.SetComplete (aggregate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,16 +98,9 @@ namespace Mono.Security.Protocol.Tls
|
||||
{
|
||||
this.EndNegotiateHandshake(asyncResult);
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
|
||||
this.protocol.SendAlert(ref ex);
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
|
||||
@@ -502,17 +495,10 @@ namespace Mono.Security.Protocol.Tls
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
this.negotiationComplete.Set();
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.negotiationComplete.Set();
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
this.protocol.SendAlert(ref ex);
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
@@ -628,15 +614,10 @@ namespace Mono.Security.Protocol.Tls
|
||||
asyncResult.SetComplete(0);
|
||||
}
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new IOException("IO exception during read.", ex);
|
||||
this.protocol.SendAlert(ref ex);
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -781,17 +762,13 @@ namespace Mono.Security.Protocol.Tls
|
||||
record, 0, record.Length, new AsyncCallback(InternalWriteCallback), asyncResult);
|
||||
}
|
||||
}
|
||||
catch (TlsException ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
this.protocol.SendAlert (ref ex);
|
||||
this.Close();
|
||||
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new IOException("IO exception during Write.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void InternalWriteCallback(IAsyncResult ar)
|
||||
@@ -1121,15 +1098,11 @@ namespace Mono.Security.Protocol.Tls
|
||||
byte[] record = this.protocol.EncodeRecord (ContentType.ApplicationData, buffer, offset, count);
|
||||
this.innerStream.Write (record, 0, record.Length);
|
||||
}
|
||||
catch (TlsException ex)
|
||||
{
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
this.Close();
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new IOException("IO exception during Write.", ex);
|
||||
this.protocol.SendAlert(ref ex);
|
||||
this.Close();
|
||||
throw new IOException("The authentication or decryption has failed.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,10 +97,26 @@ namespace Mono.Security.X509 {
|
||||
// methods
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
/*
|
||||
* Both _certificates and _crls extend CollectionBase, whose Clear() method calls OnClear() and
|
||||
* OnClearComplete(), which should be overridden in derivative classes. So we should not worry about
|
||||
* other threads that might be holding references to _certificates or _crls. They should be smart enough
|
||||
* to handle this gracefully. And if not, it's their own fault.
|
||||
*/
|
||||
ClearCertificates ();
|
||||
ClearCrls ();
|
||||
}
|
||||
|
||||
void ClearCertificates()
|
||||
{
|
||||
if (_certificates != null)
|
||||
_certificates.Clear ();
|
||||
_certificates = null;
|
||||
}
|
||||
|
||||
void ClearCrls ()
|
||||
{
|
||||
if (_crls != null)
|
||||
_crls.Clear ();
|
||||
_crls = null;
|
||||
@@ -117,6 +133,7 @@ namespace Mono.Security.X509 {
|
||||
fs.Write (data, 0, data.Length);
|
||||
fs.Close ();
|
||||
}
|
||||
ClearCertificates (); // We have modified the store on disk. So forget the old state.
|
||||
}
|
||||
#if !NET_2_1
|
||||
// Try to save privateKey if available..
|
||||
@@ -141,6 +158,7 @@ namespace Mono.Security.X509 {
|
||||
byte[] data = crl.RawData;
|
||||
fs.Write (data, 0, data.Length);
|
||||
}
|
||||
ClearCrls (); // We have modified the store on disk. So forget the old state.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +167,7 @@ namespace Mono.Security.X509 {
|
||||
string filename = Path.Combine (_storePath, GetUniqueName (certificate));
|
||||
if (File.Exists (filename)) {
|
||||
File.Delete (filename);
|
||||
ClearCertificates (); // We have modified the store on disk. So forget the old state.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,6 +176,7 @@ namespace Mono.Security.X509 {
|
||||
string filename = Path.Combine (_storePath, GetUniqueName (crl));
|
||||
if (File.Exists (filename)) {
|
||||
File.Delete (filename);
|
||||
ClearCrls (); // We have modified the store on disk. So forget the old state.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,16 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if (INSIDE_CORLIB && NET_4_0) || (!INSIDE_CORLIB && (NET_3_5 && !NET_4_0 && !MOBILE))
|
||||
#if INSIDE_CORLIB || (NET_3_5 && !NET_4_0 && !MOBILE)
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System
|
||||
{
|
||||
public sealed partial class TimeZoneInfo {
|
||||
#if NET_4_0 || !INSIDE_CORLIB
|
||||
public
|
||||
#endif
|
||||
sealed partial class TimeZoneInfo {
|
||||
[SerializableAttribute]
|
||||
#if MOBILE
|
||||
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
|
||||
|
||||
@@ -453,29 +453,29 @@ namespace System {
|
||||
: db.GetAvailableIds ();
|
||||
}
|
||||
|
||||
static TimeZoneInfo _GetTimeZone (string name)
|
||||
static TimeZoneInfo _GetTimeZone (string id, string name)
|
||||
{
|
||||
if (db == null)
|
||||
return null;
|
||||
byte[] buffer = db.GetTimeZoneData (name);
|
||||
if (buffer == null)
|
||||
return null;
|
||||
return TimeZoneInfo.ParseTZBuffer (name, buffer, buffer.Length);
|
||||
return TimeZoneInfo.ParseTZBuffer (id, buffer, buffer.Length);
|
||||
}
|
||||
|
||||
internal static TimeZoneInfo GetTimeZone (string id)
|
||||
internal static TimeZoneInfo GetTimeZone (string id, string name)
|
||||
{
|
||||
if (id != null) {
|
||||
if (id == "GMT" || id == "UTC")
|
||||
return new TimeZoneInfo (id, TimeSpan.FromSeconds (0), id, id, id, null, true);
|
||||
if (id.StartsWith ("GMT"))
|
||||
if (name != null) {
|
||||
if (name == "GMT" || name == "UTC")
|
||||
return new TimeZoneInfo (id, TimeSpan.FromSeconds (0), id, name, name, null, disableDaylightSavingTime:true);
|
||||
if (name.StartsWith ("GMT"))
|
||||
return new TimeZoneInfo (id,
|
||||
TimeSpan.FromSeconds (ParseNumericZone (id)),
|
||||
id, id, id, null, true);
|
||||
TimeSpan.FromSeconds (ParseNumericZone (name)),
|
||||
id, name, name, null, disableDaylightSavingTime:true);
|
||||
}
|
||||
|
||||
try {
|
||||
return _GetTimeZone (id);
|
||||
return _GetTimeZone (id, name);
|
||||
} catch (Exception) {
|
||||
return null;
|
||||
}
|
||||
@@ -533,12 +533,13 @@ namespace System {
|
||||
static readonly object _lock = new object ();
|
||||
|
||||
static TimeZoneInfo defaultZone;
|
||||
internal static TimeZoneInfo Default {
|
||||
internal static TimeZoneInfo Local {
|
||||
get {
|
||||
lock (_lock) {
|
||||
if (defaultZone != null)
|
||||
return defaultZone;
|
||||
return defaultZone = GetTimeZone (GetDefaultTimeZoneName ());
|
||||
var id = GetDefaultTimeZoneName ();
|
||||
return defaultZone = GetTimeZone (id, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -553,7 +554,10 @@ namespace System {
|
||||
{
|
||||
IntPtr value = IntPtr.Zero;
|
||||
int n = 0;
|
||||
string defaultTimeZone;
|
||||
string defaultTimeZone = Environment.GetEnvironmentVariable ("__XA_OVERRIDE_TIMEZONE_ID__");
|
||||
|
||||
if (!string.IsNullOrEmpty (defaultTimeZone))
|
||||
return defaultTimeZone;
|
||||
|
||||
// Used by the tests
|
||||
if (Environment.GetEnvironmentVariable ("__XA_USE_JAVA_DEFAULT_TIMEZONE_ID__") == null)
|
||||
@@ -576,16 +580,20 @@ namespace System {
|
||||
#if SELF_TEST
|
||||
/*
|
||||
* Compile:
|
||||
* mcs /out:tzi.exe /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" System/TimeZone*.cs ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
|
||||
* mcs /debug+ /out:tzi.exe /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" ../corlib/System/AndroidPlatform.cs System/TimeZone*.cs ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
|
||||
* Prep:
|
||||
* mkdir -p usr/share/zoneinfo
|
||||
* mkdir -p misc/zoneinfo/zoneinfo
|
||||
* android_root=`adb shell echo '$ANDROID_ROOT' | tr -d "\r"`
|
||||
* android_data=`adb shell echo '$ANDROID_DATA' | tr -d "\r"`
|
||||
* adb pull $android_root/usr/share/zoneinfo usr/share/zoneinfo
|
||||
* adb pull $android_data/misc/zoneinfo/tzdata misc/zoneinfo
|
||||
* Run:
|
||||
* ANDROID_ROOT=`pwd` mono tzi.exe
|
||||
* __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe --offset=1969-01-01
|
||||
*/
|
||||
static void Main (string[] args)
|
||||
{
|
||||
DateTime? offset = null;
|
||||
Func<IAndroidTimeZoneDB> c = () => GetDefaultTimeZoneDB ();
|
||||
Mono.Options.OptionSet p = null;
|
||||
p = new Mono.Options.OptionSet () {
|
||||
@@ -595,6 +603,10 @@ namespace System {
|
||||
{ "Z=", "Create ZoneInfoDB from {DIR}.", v => {
|
||||
c = () => new ZoneInfoDB (v);
|
||||
} },
|
||||
{ "offset=", "Show timezone info offset for DateTime {OFFSET}.", v => {
|
||||
offset = DateTime.Parse (v);
|
||||
Console.WriteLine ("Using DateTime Offset: {0}", offset);
|
||||
} },
|
||||
{ "help", "Show this message and exit", v => {
|
||||
p.WriteOptionDescriptions (Console.Out);
|
||||
Environment.Exit (0);
|
||||
@@ -606,9 +618,13 @@ namespace System {
|
||||
foreach (var id in GetAvailableIds ()) {
|
||||
Console.Write ("name={0,-40}", id);
|
||||
try {
|
||||
TimeZoneInfo zone = _GetTimeZone (id);
|
||||
if (zone != null)
|
||||
Console.Write (" {0}", zone);
|
||||
TimeZoneInfo zone = _GetTimeZone (id, id);
|
||||
if (zone != null) {
|
||||
Console.Write (" {0,-40}", zone);
|
||||
if (offset.HasValue) {
|
||||
Console.Write ("From Offset: {0}", zone.GetUtcOffset (offset.Value));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Console.Write (" ERROR:null");
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if (INSIDE_CORLIB && NET_4_0) || (!INSIDE_CORLIB && (NET_3_5 && !NET_4_0 && !MOBILE))
|
||||
#if INSIDE_CORLIB || (NET_3_5 && !NET_4_0 && !MOBILE)
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -33,7 +33,10 @@ using System.Text;
|
||||
|
||||
namespace System
|
||||
{
|
||||
public partial class TimeZoneInfo
|
||||
#if NET_4_0 || !INSIDE_CORLIB
|
||||
public
|
||||
#endif
|
||||
partial class TimeZoneInfo
|
||||
{
|
||||
public static TimeZoneInfo FromSerializedString (string source)
|
||||
{
|
||||
|
||||
@@ -24,14 +24,17 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if (INSIDE_CORLIB && NET_4_0) || (!INSIDE_CORLIB && (NET_3_5 && !NET_4_0 && !MOBILE))
|
||||
#if INSIDE_CORLIB || (NET_3_5 && !NET_4_0 && !MOBILE)
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System
|
||||
{
|
||||
public sealed partial class TimeZoneInfo
|
||||
#if NET_4_0 || !INSIDE_CORLIB
|
||||
public
|
||||
#endif
|
||||
sealed partial class TimeZoneInfo
|
||||
{
|
||||
[SerializableAttribute]
|
||||
#if MOBILE
|
||||
|
||||
@@ -35,7 +35,7 @@ using System.Threading;
|
||||
|
||||
[assembly:TypeForwardedTo (typeof(TimeZoneInfo))]
|
||||
|
||||
#elif (INSIDE_CORLIB && NET_4_0) || (!INSIDE_CORLIB && (NET_3_5 && !NET_4_0 && !MOBILE))
|
||||
#elif INSIDE_CORLIB || (NET_3_5 && !NET_4_0 && !MOBILE)
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -57,7 +57,10 @@ namespace System
|
||||
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
|
||||
#endif
|
||||
[SerializableAttribute]
|
||||
public sealed partial class TimeZoneInfo : IEquatable<TimeZoneInfo>, ISerializable, IDeserializationCallback
|
||||
#if NET_4_0 || !INSIDE_CORLIB
|
||||
public
|
||||
#endif
|
||||
sealed partial class TimeZoneInfo : IEquatable<TimeZoneInfo>, ISerializable, IDeserializationCallback
|
||||
{
|
||||
TimeSpan baseUtcOffset;
|
||||
public TimeSpan BaseUtcOffset {
|
||||
@@ -100,15 +103,31 @@ namespace System
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
TimeZone transitions are stored when there is a change on the base offset.
|
||||
*/
|
||||
private List<KeyValuePair<DateTime, TimeType>> transitions;
|
||||
|
||||
static TimeZoneInfo CreateLocal ()
|
||||
{
|
||||
#if MONODROID
|
||||
return AndroidTimeZones.Default;
|
||||
return AndroidTimeZones.Local;
|
||||
#elif MONOTOUCH
|
||||
using (Stream stream = GetMonoTouchData (null)) {
|
||||
return BuildFromStream ("Local", stream);
|
||||
}
|
||||
#elif LIBC
|
||||
var tz = Environment.GetEnvironmentVariable ("TZ");
|
||||
if (tz != null) {
|
||||
if (tz == String.Empty)
|
||||
return Utc;
|
||||
try {
|
||||
return FindSystemTimeZoneByFileName (tz, Path.Combine (TimeZoneDirectory, tz));
|
||||
} catch {
|
||||
return Utc;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return FindSystemTimeZoneByFileName ("Local", "/etc/localtime");
|
||||
} catch {
|
||||
@@ -332,8 +351,7 @@ namespace System
|
||||
if (dateTime.Kind == DateTimeKind.Utc)
|
||||
return dateTime;
|
||||
|
||||
//FIXME: do not rely on DateTime implementation !
|
||||
return DateTime.SpecifyKind (dateTime.ToUniversalTime (), DateTimeKind.Utc);
|
||||
return ConvertTimeToUtc (dateTime, TimeZoneInfo.Local);
|
||||
}
|
||||
|
||||
public static DateTime ConvertTimeToUtc (DateTime dateTime, TimeZoneInfo sourceTimeZone)
|
||||
@@ -350,15 +368,9 @@ namespace System
|
||||
if (sourceTimeZone.IsInvalidTime (dateTime))
|
||||
throw new ArgumentException ("dateTime parameter is an invalid time");
|
||||
|
||||
if (dateTime.Kind == DateTimeKind.Utc && sourceTimeZone == TimeZoneInfo.Utc)
|
||||
return dateTime;
|
||||
|
||||
if (dateTime.Kind == DateTimeKind.Utc)
|
||||
return dateTime;
|
||||
|
||||
if (dateTime.Kind == DateTimeKind.Local)
|
||||
return ConvertTimeToUtc (dateTime);
|
||||
|
||||
if (sourceTimeZone.IsAmbiguousTime (dateTime) || !sourceTimeZone.IsDaylightSavingTime (dateTime))
|
||||
return DateTime.SpecifyKind (dateTime - sourceTimeZone.BaseUtcOffset, DateTimeKind.Utc);
|
||||
else {
|
||||
@@ -414,12 +426,6 @@ namespace System
|
||||
return FromRegistryKey(id, key);
|
||||
}
|
||||
#endif
|
||||
#if MONODROID
|
||||
var timeZoneInfo = AndroidTimeZones.GetTimeZone (id);
|
||||
if (timeZoneInfo == null)
|
||||
throw new TimeZoneNotFoundException ();
|
||||
return timeZoneInfo;
|
||||
#else
|
||||
// Local requires special logic that already exists in the Local property (bug #326)
|
||||
if (id == "Local")
|
||||
return Local;
|
||||
@@ -427,12 +433,16 @@ namespace System
|
||||
using (Stream stream = GetMonoTouchData (id)) {
|
||||
return BuildFromStream (id, stream);
|
||||
}
|
||||
#elif MONODROID
|
||||
var timeZoneInfo = AndroidTimeZones.GetTimeZone (id, id);
|
||||
if (timeZoneInfo == null)
|
||||
throw new TimeZoneNotFoundException ();
|
||||
return timeZoneInfo;
|
||||
#elif LIBC
|
||||
string filepath = Path.Combine (TimeZoneDirectory, id);
|
||||
return FindSystemTimeZoneByFileName (id, filepath);
|
||||
#else
|
||||
throw new NotImplementedException ();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -644,7 +654,7 @@ namespace System
|
||||
#endif
|
||||
#if MONODROID
|
||||
foreach (string id in AndroidTimeZones.GetAvailableIds ()) {
|
||||
var tz = AndroidTimeZones.GetTimeZone (id);
|
||||
var tz = AndroidTimeZones.GetTimeZone (id, id);
|
||||
if (tz != null)
|
||||
systemTimeZones.Add (tz);
|
||||
}
|
||||
@@ -684,13 +694,8 @@ namespace System
|
||||
|
||||
public TimeSpan GetUtcOffset (DateTime dateTime)
|
||||
{
|
||||
if (IsDaylightSavingTime (dateTime)) {
|
||||
AdjustmentRule rule = GetApplicableRule (dateTime);
|
||||
if (rule != null)
|
||||
return BaseUtcOffset + rule.DaylightDelta;
|
||||
}
|
||||
|
||||
return BaseUtcOffset;
|
||||
bool isDST;
|
||||
return GetUtcOffset (dateTime, out isDST);
|
||||
}
|
||||
|
||||
public TimeSpan GetUtcOffset (DateTimeOffset dateTimeOffset)
|
||||
@@ -698,6 +703,82 @@ namespace System
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
private TimeSpan GetUtcOffset (DateTime dateTime, out bool isDST)
|
||||
{
|
||||
isDST = false;
|
||||
|
||||
TimeZoneInfo tz = this;
|
||||
if (dateTime.Kind == DateTimeKind.Utc)
|
||||
tz = TimeZoneInfo.Utc;
|
||||
|
||||
if (dateTime.Kind == DateTimeKind.Local)
|
||||
tz = TimeZoneInfo.Local;
|
||||
|
||||
bool isTzDst;
|
||||
var tzOffset = GetUtcOffset (dateTime, tz, out isTzDst);
|
||||
|
||||
if (tz == this) {
|
||||
isDST = isTzDst;
|
||||
return tzOffset;
|
||||
}
|
||||
|
||||
var utcTicks = dateTime.Ticks - tzOffset.Ticks;
|
||||
if (utcTicks < 0 || utcTicks > DateTime.MaxValue.Ticks)
|
||||
return BaseUtcOffset;
|
||||
|
||||
var utcDateTime = new DateTime (utcTicks, DateTimeKind.Utc);
|
||||
|
||||
return GetUtcOffset (utcDateTime, this, out isDST);
|
||||
}
|
||||
|
||||
private static TimeSpan GetUtcOffset (DateTime dateTime, TimeZoneInfo tz, out bool isDST)
|
||||
{
|
||||
if (dateTime.Kind == DateTimeKind.Local && tz != TimeZoneInfo.Local)
|
||||
throw new Exception ();
|
||||
|
||||
isDST = false;
|
||||
|
||||
if (tz == TimeZoneInfo.Utc)
|
||||
return TimeSpan.Zero;
|
||||
|
||||
TimeSpan offset;
|
||||
if (tz.TryGetTransitionOffset(dateTime, out offset, out isDST))
|
||||
return offset;
|
||||
|
||||
if (dateTime.Kind == DateTimeKind.Utc) {
|
||||
var utcRule = tz.GetApplicableRule (dateTime);
|
||||
if (utcRule != null && tz.IsInDST (utcRule, dateTime)) {
|
||||
isDST = true;
|
||||
return tz.BaseUtcOffset + utcRule.DaylightDelta;
|
||||
}
|
||||
|
||||
return tz.BaseUtcOffset;
|
||||
}
|
||||
|
||||
var stdTicks = dateTime.Ticks - tz.BaseUtcOffset.Ticks;
|
||||
if (stdTicks < 0 || stdTicks > DateTime.MaxValue.Ticks)
|
||||
return tz.BaseUtcOffset;
|
||||
|
||||
var stdUtcDateTime = new DateTime (stdTicks, DateTimeKind.Utc);
|
||||
var tzRule = tz.GetApplicableRule (stdUtcDateTime);
|
||||
|
||||
DateTime dstUtcDateTime = DateTime.MinValue;
|
||||
if (tzRule != null) {
|
||||
var dstTicks = stdUtcDateTime.Ticks - tzRule.DaylightDelta.Ticks;
|
||||
if (dstTicks < 0 || dstTicks > DateTime.MaxValue.Ticks)
|
||||
return tz.BaseUtcOffset;
|
||||
|
||||
dstUtcDateTime = new DateTime (dstTicks, DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
if (tzRule != null && tz.IsInDST (tzRule, stdUtcDateTime) && tz.IsInDST (tzRule, dstUtcDateTime)) {
|
||||
isDST = true;
|
||||
return tz.BaseUtcOffset + tzRule.DaylightDelta;
|
||||
}
|
||||
|
||||
return tz.BaseUtcOffset;
|
||||
}
|
||||
|
||||
public bool HasSameRules (TimeZoneInfo other)
|
||||
{
|
||||
if (other == null)
|
||||
@@ -752,6 +833,16 @@ namespace System
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
private bool IsInDST (AdjustmentRule rule, DateTime dateTime)
|
||||
{
|
||||
// Check whether we're in the dateTime year's DST period
|
||||
if (IsInDSTForYear (rule, dateTime, dateTime.Year))
|
||||
return true;
|
||||
|
||||
// We might be in the dateTime previous year's DST period
|
||||
return IsInDSTForYear (rule, dateTime, dateTime.Year - 1);
|
||||
}
|
||||
|
||||
bool IsInDSTForYear (AdjustmentRule rule, DateTime dateTime, int year)
|
||||
{
|
||||
DateTime DST_start = TransitionPoint (rule.DaylightTransitionStart, year);
|
||||
@@ -774,25 +865,11 @@ namespace System
|
||||
|
||||
if (!SupportsDaylightSavingTime)
|
||||
return false;
|
||||
|
||||
//FIXME: do not rely on DateTime implementation !
|
||||
if ((dateTime.Kind == DateTimeKind.Local || dateTime.Kind == DateTimeKind.Unspecified) && this == TimeZoneInfo.Local)
|
||||
return dateTime.IsDaylightSavingTime ();
|
||||
|
||||
//FIXME: do not rely on DateTime implementation !
|
||||
if (dateTime.Kind == DateTimeKind.Local && this != TimeZoneInfo.Utc)
|
||||
return IsDaylightSavingTime (DateTime.SpecifyKind (dateTime.ToUniversalTime (), DateTimeKind.Utc));
|
||||
|
||||
AdjustmentRule rule = GetApplicableRule (dateTime.Date);
|
||||
if (rule == null)
|
||||
return false;
|
||||
|
||||
// Check whether we're in the dateTime year's DST period
|
||||
if (IsInDSTForYear (rule, dateTime, dateTime.Year))
|
||||
return true;
|
||||
bool isDst;
|
||||
GetUtcOffset (dateTime, out isDst);
|
||||
|
||||
// We might be in the dateTime previous year's DST period
|
||||
return IsInDSTForYear (rule, dateTime, dateTime.Year - 1);
|
||||
return isDst;
|
||||
}
|
||||
|
||||
public bool IsDaylightSavingTime (DateTimeOffset dateTimeOffset)
|
||||
@@ -969,6 +1046,40 @@ namespace System
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool TryGetTransitionOffset (DateTime dateTime, out TimeSpan offset,out bool isDst)
|
||||
{
|
||||
offset = BaseUtcOffset;
|
||||
isDst = false;
|
||||
|
||||
if (transitions == null)
|
||||
return false;
|
||||
|
||||
//Transitions are always in standard time
|
||||
DateTime date = dateTime;
|
||||
|
||||
if (dateTime.Kind == DateTimeKind.Local && this != TimeZoneInfo.Local)
|
||||
date = date.ToUniversalTime () + BaseUtcOffset;
|
||||
|
||||
if (dateTime.Kind == DateTimeKind.Utc && this != TimeZoneInfo.Utc)
|
||||
date = date + BaseUtcOffset;
|
||||
|
||||
for (var i = transitions.Count - 1; i >= 0; i--) {
|
||||
var pair = transitions [i];
|
||||
DateTime ttime = pair.Key;
|
||||
TimeType ttype = pair.Value;
|
||||
|
||||
if (ttime > date)
|
||||
continue;
|
||||
|
||||
offset = new TimeSpan (0, 0, ttype.Offset);
|
||||
isDst = ttype.IsDst;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static DateTime TransitionPoint (TransitionTime transition, int year)
|
||||
{
|
||||
if (transition.IsFixedDateRule)
|
||||
@@ -1059,6 +1170,7 @@ namespace System
|
||||
bool dst_observed = false;
|
||||
DateTime dst_start = DateTime.MinValue;
|
||||
List<AdjustmentRule> adjustmentRules = new List<AdjustmentRule> ();
|
||||
bool storeTransition = false;
|
||||
|
||||
for (int i = 0; i < transitions.Count; i++) {
|
||||
var pair = transitions [i];
|
||||
@@ -1069,6 +1181,8 @@ namespace System
|
||||
standardDisplayName = ttype.Name;
|
||||
daylightDisplayName = null;
|
||||
baseUtcOffset = new TimeSpan (0, 0, ttype.Offset);
|
||||
if (adjustmentRules.Count > 0) // We ignore AdjustmentRules but store transitions.
|
||||
storeTransition = true;
|
||||
adjustmentRules = new List<AdjustmentRule> ();
|
||||
dst_observed = false;
|
||||
}
|
||||
@@ -1110,16 +1224,22 @@ namespace System
|
||||
}
|
||||
}
|
||||
|
||||
if (adjustmentRules.Count == 0) {
|
||||
TimeZoneInfo tz;
|
||||
if (adjustmentRules.Count == 0 && !storeTransition) {
|
||||
TimeType t = (TimeType)time_types [0];
|
||||
if (standardDisplayName == null) {
|
||||
standardDisplayName = t.Name;
|
||||
baseUtcOffset = new TimeSpan (0, 0, t.Offset);
|
||||
}
|
||||
return CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName);
|
||||
tz = CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName);
|
||||
} else {
|
||||
return CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName, daylightDisplayName, ValidateRules (adjustmentRules).ToArray ());
|
||||
tz = CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName, daylightDisplayName, ValidateRules (adjustmentRules).ToArray ());
|
||||
}
|
||||
|
||||
if (storeTransition)
|
||||
tz.transitions = transitions;
|
||||
|
||||
return tz;
|
||||
}
|
||||
|
||||
static Dictionary<int, string> ParseAbbreviations (byte [] buffer, int index, int count)
|
||||
|
||||
@@ -401,9 +401,14 @@ namespace MonoTests.System.Threading
|
||||
{
|
||||
var v = new ReaderWriterLockSlim ();
|
||||
int local = 10;
|
||||
int ready_count = 0;
|
||||
int entered_count = 0;
|
||||
const int thread_count = 10;
|
||||
|
||||
var r = from i in Enumerable.Range (1, 10) select new Thread (() => {
|
||||
var r = from i in Enumerable.Range (1, thread_count) select new Thread (() => {
|
||||
Interlocked.Increment (ref ready_count);
|
||||
v.EnterReadLock ();
|
||||
Interlocked.Increment (ref entered_count);
|
||||
|
||||
Assert.AreEqual (11, local);
|
||||
});
|
||||
@@ -415,12 +420,16 @@ namespace MonoTests.System.Threading
|
||||
t.Start ();
|
||||
}
|
||||
|
||||
Thread.Sleep (200);
|
||||
while (ready_count != thread_count)
|
||||
Thread.Sleep (10);
|
||||
|
||||
/* Extra up to 2s of sleep to ensure all threads got the chance to enter the lock */
|
||||
for (int i = 0; i < 200 && v.WaitingReadCount != thread_count; ++i)
|
||||
Thread.Sleep (10);
|
||||
local = 11;
|
||||
|
||||
// FIXME: Don't rely on Thread.Sleep (200)
|
||||
Assert.AreEqual (0, v.WaitingWriteCount, "in waiting write");
|
||||
Assert.AreEqual (10, v.WaitingReadCount, "in waiting read");
|
||||
Assert.AreEqual (thread_count, v.WaitingReadCount, "in waiting read");
|
||||
Assert.AreEqual (0, v.WaitingUpgradeCount, "in waiting upgrade");
|
||||
v.ExitWriteLock ();
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace MonoTests.System
|
||||
DateTime afterDST = new DateTime (2007, 10, 28, 2, 0, 0, DateTimeKind.Unspecified);
|
||||
Assert.IsFalse (london.IsDaylightSavingTime (beforeDST), "Just before DST");
|
||||
Assert.IsTrue (london.IsDaylightSavingTime (startDST), "the first seconds of DST");
|
||||
Assert.IsTrue (london.IsDaylightSavingTime (endDST), "The last seconds of DST");
|
||||
Assert.IsFalse (london.IsDaylightSavingTime (endDST), "The last seconds of DST");
|
||||
Assert.IsFalse (london.IsDaylightSavingTime (afterDST), "Just after DST");
|
||||
}
|
||||
|
||||
@@ -804,6 +804,143 @@ namespace MonoTests.System
|
||||
Assert.IsTrue (london.Equals (deserialized));
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class MultipleDaylightSavingTimeTests {
|
||||
private TimeZoneInfo cairo;
|
||||
private DateTime dst1Start;
|
||||
private DateTime dst1End;
|
||||
private DateTime dst2Start;
|
||||
private DateTime dst2End;
|
||||
|
||||
private TimeSpan baseUtcOffset;
|
||||
private TimeSpan dstUtcOffset;
|
||||
private TimeSpan dstOffset;
|
||||
|
||||
[SetUp]
|
||||
public void CreateTimeZones ()
|
||||
{
|
||||
/*
|
||||
From 1/1/2014 12:00:00 AM to 6/30/2014 12:00:00 AM
|
||||
Delta: 01:00:00
|
||||
Begins at 12:00 AM on 16 May
|
||||
Ends at 1:00 AM on 29 June
|
||||
From 7/1/2014 12:00:00 AM to 12/31/2014 12:00:00 AM
|
||||
Delta: 01:00:00
|
||||
Begins at 12:00 AM on 29 July
|
||||
Ends at 12:00 AM on 26 September
|
||||
*/
|
||||
dst1Start = new DateTime (2014, 5, 16);
|
||||
dst1End = new DateTime (2014, 6, 29);
|
||||
dst2Start = new DateTime (2014, 7, 29);
|
||||
dst2End = new DateTime (2014, 9, 26);
|
||||
|
||||
baseUtcOffset = new TimeSpan (2, 0, 0);
|
||||
dstUtcOffset = new TimeSpan (3, 0, 0);
|
||||
dstOffset = dstUtcOffset - baseUtcOffset;
|
||||
|
||||
var rule1 = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule (
|
||||
new DateTime (2014, 1, 1), new DateTime (2014, 6, 30), dstOffset,
|
||||
CreateFixedDateRule (dst1Start), CreateFixedDateRule (dst1End));
|
||||
|
||||
var rule2 = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule (
|
||||
new DateTime (2014, 7, 1), new DateTime (2014, 12, 31), dstOffset,
|
||||
CreateFixedDateRule (dst2Start), CreateFixedDateRule (dst2End));
|
||||
|
||||
cairo = TimeZoneInfo.CreateCustomTimeZone ("Africa/Cairo", baseUtcOffset, "Africa/Cairo", "EET", "EEST",
|
||||
new [] {rule1, rule2});
|
||||
}
|
||||
|
||||
private static TimeZoneInfo.TransitionTime CreateFixedDateRule (DateTime dateTime)
|
||||
{
|
||||
var time = new DateTime (dateTime.Ticks - dateTime.Date.Ticks);
|
||||
return TimeZoneInfo.TransitionTime.CreateFixedDateRule (time, dateTime.Month, dateTime.Day);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUtcOffset_FromUTC ()
|
||||
{
|
||||
var d = dst1Start.Add (-baseUtcOffset);
|
||||
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
|
||||
d = dst1End.Add (-baseUtcOffset-dstOffset);
|
||||
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
|
||||
d = dst2Start.Add (-baseUtcOffset);
|
||||
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
|
||||
d = dst2End.Add (-baseUtcOffset-dstOffset);
|
||||
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUtcOffset_FromLocal ()
|
||||
{
|
||||
var d = dst1Start.Add (-baseUtcOffset);
|
||||
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
|
||||
d = d.ToLocalTime ();
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
|
||||
d = dst1End.Add (-baseUtcOffset-dstOffset);
|
||||
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
|
||||
d = d.ToLocalTime ();
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
|
||||
d = dst2Start.Add (-baseUtcOffset);
|
||||
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
|
||||
d = d.ToLocalTime ();
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
|
||||
d = dst2End.Add (-baseUtcOffset-dstOffset);
|
||||
d = DateTime.SpecifyKind (d, DateTimeKind.Utc);
|
||||
d = d.ToLocalTime ();
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUtcOffset_FromUnspecified ()
|
||||
{
|
||||
var d = dst1Start.Add (dstOffset);
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
|
||||
d = dst1End.Add (-dstOffset);
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
|
||||
d = dst2Start.Add (dstOffset);
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
|
||||
d = dst2End.Add (-dstOffset);
|
||||
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0,-1))));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
|
||||
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -206,6 +206,7 @@
|
||||
<Compile Include="System.Data.SqlClient\SqlCommandBuilder.cs" />
|
||||
<Compile Include="System.Data.SqlClient\SqlConnection.cs" />
|
||||
<Compile Include="System.Data.SqlClient\SqlConnectionStringBuilder.cs" />
|
||||
<Compile Include="System.Data.SqlClient\SqlCredential.cs" />
|
||||
<Compile Include="System.Data.SqlClient\SqlDataAdapter.cs" />
|
||||
<Compile Include="System.Data.SqlClient\SqlDataReader.cs" />
|
||||
<Compile Include="System.Data.SqlClient\SqlDataSourceConverter.cs" />
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace System.Data.Common {
|
||||
readonly IDataReader reader;
|
||||
readonly bool closeReader;
|
||||
readonly SchemaInfo [] schema;
|
||||
readonly object [] values;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
@@ -58,7 +57,6 @@ namespace System.Data.Common {
|
||||
{
|
||||
this.reader = reader;
|
||||
this.closeReader = closeReader;
|
||||
this.values = new object [reader.FieldCount];
|
||||
this.schema = LoadSchema (reader);
|
||||
}
|
||||
|
||||
@@ -67,8 +65,13 @@ namespace System.Data.Common {
|
||||
#region Properties
|
||||
|
||||
public object Current {
|
||||
get {
|
||||
get {
|
||||
// DbDataRecordImpl does not do copy of the array
|
||||
// and MoveNext would overwrite any previously filled data
|
||||
var values = new object [reader.FieldCount];
|
||||
reader.GetValues (values);
|
||||
|
||||
// TODO: Should not allocate on every property call
|
||||
return new DbDataRecordImpl (schema, values);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ using System.Xml;
|
||||
#if NET_2_0
|
||||
using System.Collections.Generic;
|
||||
#endif
|
||||
using System.Security;
|
||||
|
||||
namespace System.Data.SqlClient
|
||||
{
|
||||
@@ -93,6 +94,9 @@ namespace System.Data.SqlClient
|
||||
// The connection string that identifies this connection
|
||||
string connectionString;
|
||||
|
||||
// The connection credentials
|
||||
SqlCredential credentials;
|
||||
|
||||
// The transaction object for the current transaction
|
||||
SqlTransaction transaction;
|
||||
|
||||
@@ -133,6 +137,12 @@ namespace System.Data.SqlClient
|
||||
ConnectionString = connectionString;
|
||||
}
|
||||
|
||||
public SqlConnection (string connectionString, SqlCredential cred)
|
||||
{
|
||||
ConnectionString = connectionString;
|
||||
Credentials = cred;
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properties
|
||||
@@ -155,6 +165,15 @@ namespace System.Data.SqlClient
|
||||
}
|
||||
}
|
||||
|
||||
public SqlCredential Credentials {
|
||||
get {
|
||||
return credentials;
|
||||
}
|
||||
set {
|
||||
credentials = value;
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET_2_0
|
||||
[DataSysDescription ("Current connection timeout value, 'Connect Timeout=X' in the ConnectionString.")]
|
||||
#endif
|
||||
@@ -563,6 +582,16 @@ namespace System.Data.SqlClient
|
||||
|
||||
if (!tds.IsConnected) {
|
||||
try {
|
||||
if (Credentials != null) {
|
||||
if (parms.User != String.Empty)
|
||||
throw new ArgumentException("UserID already specified");
|
||||
if (parms.PasswordSet)
|
||||
throw new ArgumentException("Password already specified");
|
||||
if (parms.DomainLogin != false)
|
||||
throw new ArgumentException("Cannot use credentials with DomainLogin");
|
||||
parms.User = Credentials.UserId;
|
||||
parms.Password = Credentials.Password;
|
||||
}
|
||||
tds.Connect (parms);
|
||||
} catch {
|
||||
if (pooling)
|
||||
@@ -879,7 +908,10 @@ namespace System.Data.SqlClient
|
||||
break;
|
||||
case "password" :
|
||||
case "pwd" :
|
||||
parms.Password = value;
|
||||
parms.Password = new SecureString();
|
||||
foreach (char c in value)
|
||||
parms.Password.AppendChar(c);
|
||||
parms.PasswordSet = true;
|
||||
break;
|
||||
case "persistsecurityinfo" :
|
||||
case "persist security info" :
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// System.Data.SqlClient.SqlCredential.cs
|
||||
//
|
||||
// Author:
|
||||
// Neale Ferguson ([email protected])
|
||||
//
|
||||
// Copyright (C) Neale Ferguson, 2014
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// 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.Data;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace System.Data.SqlClient {
|
||||
/// <summary>
|
||||
/// Describes an error from a SQL database.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public sealed class SqlCredential
|
||||
{
|
||||
#region Fields
|
||||
|
||||
string uid = "";
|
||||
SecureString pwd = null;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
public SqlCredential (string user, SecureString password)
|
||||
{
|
||||
if (user == null)
|
||||
throw new ArgumentNullException("UserID");
|
||||
if (password == null)
|
||||
throw new ArgumentNullException("Password");
|
||||
this.uid = user;
|
||||
this.pwd = password;
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
public string UserId {
|
||||
get { return uid; }
|
||||
}
|
||||
|
||||
public SecureString Password {
|
||||
get { return pwd; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -289,6 +289,7 @@ System.Data.SqlClient/SqlCommand.cs
|
||||
System.Data.SqlClient/SqlCommandBuilder.cs
|
||||
System.Data.SqlClient/SqlConnection.cs
|
||||
System.Data.SqlClient/SqlConnectionStringBuilder.cs
|
||||
System.Data.SqlClient/SqlCredential.cs
|
||||
System.Data.SqlClient/SqlDataAdapter.cs
|
||||
System.Data.SqlClient/SqlDataReader.cs
|
||||
System.Data.SqlClient/SqlDataSourceConverter.cs
|
||||
|
||||
@@ -225,6 +225,7 @@ System.Data.SqlClient/SqlCommand.cs
|
||||
System.Data.SqlClient/SqlCommandBuilder.cs
|
||||
System.Data.SqlClient/SqlConnection.cs
|
||||
System.Data.SqlClient/SqlConnectionStringBuilder.cs
|
||||
System.Data.SqlClient/SqlCredential.cs
|
||||
System.Data.SqlClient/SqlDataAdapter.cs
|
||||
System.Data.SqlClient/SqlDataReader.cs
|
||||
System.Data.SqlClient/SqlDataSourceConverter.cs
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// BootstrapContext.cs
|
||||
//
|
||||
// Author:
|
||||
// Robert J. van der Boon ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Robert J. van der Boon
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#if NET_4_5
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace System.IdentityModel.Tokens {
|
||||
[Serializable]
|
||||
public class BootstrapContext : ISerializable {
|
||||
/// <summary>Gets the string that was used to initialize the context.</summary>
|
||||
public string Token { get; private set; }
|
||||
/// <summary>Gets the array that was used to initialize the context.</summary>
|
||||
public byte [] TokenBytes { get; private set; }
|
||||
/// <summary>Gets the security token that was used to initialize the context.</summary>
|
||||
public SecurityToken SecurityToken { get; private set; }
|
||||
/// <summary>Gets the token handler that was used to initialize the context.</summary>
|
||||
public SecurityTokenHandler SecurityTokenHandler { get; private set; }
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="BootstrapContext"/> class by using the specified string.</summary>
|
||||
public BootstrapContext (string token)
|
||||
{
|
||||
if (token == null)
|
||||
throw new ArgumentNullException ("token");
|
||||
Token = token;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="BootstrapContext"/> class by using the specified array.</summary>
|
||||
public BootstrapContext (byte [] token)
|
||||
{
|
||||
if (token == null)
|
||||
throw new ArgumentNullException ("token");
|
||||
TokenBytes = token;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="BootstrapContext"/> class by using the specified security token and token handler.</summary>
|
||||
public BootstrapContext (SecurityToken token, SecurityTokenHandler handler)
|
||||
{
|
||||
if (token == null)
|
||||
throw new ArgumentNullException ("token");
|
||||
if (handler == null)
|
||||
throw new ArgumentNullException ("handler");
|
||||
SecurityToken = token;
|
||||
SecurityTokenHandler = handler;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="BootstrapContext"/> class from a stream.</summary>
|
||||
protected BootstrapContext (SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException ("info");
|
||||
char type = info.GetChar ("K");
|
||||
switch (type) {
|
||||
case 'S':
|
||||
Token = info.GetString ("T");
|
||||
break;
|
||||
case 'B':
|
||||
TokenBytes = (byte [])info.GetValue ("T", typeof (byte []));
|
||||
break;
|
||||
case 'T':
|
||||
Token = Encoding.UTF8.GetString (Convert.FromBase64String (info.GetString ("T")));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Populates the <see cref="SerializationInfo"/> with data needed to serialize the current <see cref="BootstrapContext"/> object.</summary>
|
||||
public void GetObjectData (SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException ("info");
|
||||
if (Token != null) {
|
||||
info.AddValue ("K", 'S');
|
||||
info.AddValue ("T", Token);
|
||||
} else if (TokenBytes != null) {
|
||||
info.AddValue ("K", 'B');
|
||||
info.AddValue ("T", TokenBytes);
|
||||
} else if (SecurityToken != null && SecurityTokenHandler != null) {
|
||||
info.AddValue ("K", 'T');
|
||||
using (var ms = new MemoryStream ())
|
||||
using (var streamWriter = new StreamWriter (ms, new UTF8Encoding (false)))
|
||||
using (var writer = XmlWriter.Create (streamWriter, new XmlWriterSettings { OmitXmlDeclaration = true })) {
|
||||
SecurityTokenHandler.WriteToken (writer, SecurityToken);
|
||||
writer.Flush ();
|
||||
info.AddValue ("T", Convert.ToBase64String (ms.ToArray ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -54,6 +54,7 @@ System.IdentityModel.Tokens/AudienceRestriction.cs
|
||||
System.IdentityModel.Tokens/AuthenticationContext.cs
|
||||
System.IdentityModel.Tokens/AuthenticationInformation.cs
|
||||
System.IdentityModel.Tokens/BinaryKeyIdentifierClause.cs
|
||||
System.IdentityModel.Tokens/BootstrapContext.cs
|
||||
System.IdentityModel.Tokens/EncryptedKeyIdentifierClause.cs
|
||||
System.IdentityModel.Tokens/EncryptingCredentials.cs
|
||||
System.IdentityModel.Tokens/GenericXmlSecurityToken.cs
|
||||
|
||||
@@ -12,6 +12,7 @@ System.IdentityModel.Selectors/SecurityTokenResolverTest.cs
|
||||
System.IdentityModel.Selectors/TestEvaluationContext.cs
|
||||
System.IdentityModel.Selectors/X509SecurityTokenAuthenticatorTest.cs
|
||||
System.IdentityModel.Selectors/X509SecurityTokenProviderTest.cs
|
||||
System.IdentityModel.Tokens/BootstrapContextTest.cs
|
||||
System.IdentityModel.Tokens/EncryptedKeyIdentifierClauseTest.cs
|
||||
System.IdentityModel.Tokens/InMemorySymmetricSecurityKeyTest.cs
|
||||
System.IdentityModel.Tokens/LocalIdKeyIdentifierClauseTest.cs
|
||||
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
//
|
||||
// BootstrapContextTest.cs - NUnit Test Cases for System.IdentityModel.Tokens.BootstrapContext
|
||||
//
|
||||
|
||||
#if NET_4_5
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IdentityModel.Tokens;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.IdentityModel.Tokens.net_4_5 {
|
||||
[TestFixture]
|
||||
public class BootstrapContextTest {
|
||||
// The following byte arrays are the serialized bytes as emitted on Microsoft .Net 4.5.
|
||||
private static readonly byte [] SerializedBootstrapContextByteArray = new byte [] { 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x02, 0x00, 0x00, 0x00, 0x57, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x4D, 0x6F, 0x64, 0x65, 0x6C, 0x2C, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x34, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x2C, 0x20, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x3D, 0x6E, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6C, 0x2C, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x4B, 0x65, 0x79, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x3D, 0x62, 0x37, 0x37, 0x61, 0x35, 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39, 0x05, 0x01, 0x00, 0x00, 0x00, 0x2C, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x4D, 0x6F, 0x64, 0x65, 0x6C, 0x2E, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x73, 0x2E, 0x42, 0x6F, 0x6F, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x78, 0x74, 0x02, 0x00, 0x00, 0x00, 0x01, 0x4B, 0x01, 0x54, 0x00, 0x07, 0x03, 0x02, 0x02, 0x00, 0x00, 0x00, 0x42, 0x09, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x01, 0x0B };
|
||||
private static readonly byte [] SerializedBootstrapContextString = new byte [] { 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x02, 0x00, 0x00, 0x00, 0x57, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x4D, 0x6F, 0x64, 0x65, 0x6C, 0x2C, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x34, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x2C, 0x20, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x3D, 0x6E, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6C, 0x2C, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x4B, 0x65, 0x79, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x3D, 0x62, 0x37, 0x37, 0x61, 0x35, 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39, 0x05, 0x01, 0x00, 0x00, 0x00, 0x2C, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x4D, 0x6F, 0x64, 0x65, 0x6C, 0x2E, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x73, 0x2E, 0x42, 0x6F, 0x6F, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x78, 0x74, 0x02, 0x00, 0x00, 0x00, 0x01, 0x4B, 0x01, 0x54, 0x00, 0x01, 0x03, 0x02, 0x00, 0x00, 0x00, 0x53, 0x06, 0x03, 0x00, 0x00, 0x00, 0x05, 0x74, 0x6F, 0x6B, 0x65, 0x6E, 0x0B };
|
||||
|
||||
// Put in some non-ascii/latin1 characters to test the encoding scheme
|
||||
// \u018E == Latin capital letter Reversed E
|
||||
private const string user = "us\u018Er";
|
||||
// \u00BD == Vulgar Fraction one half
|
||||
private const string password = "pass\u00BDword";
|
||||
private static readonly string SerializedBootstrapContextSecurityTokenString = "<UserNameSecurityToken Id=\"uuid-927c0b98-ba18-49d2-a653-306d60f85751-3\" Username=\"" + user + "\" Password=\"" + password + "\"/>";
|
||||
private static readonly byte [] SerializedBootstrapContextSecurityToken = new byte [] { 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x02, 0x00, 0x00, 0x00, 0x57, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x4D, 0x6F, 0x64, 0x65, 0x6C, 0x2C, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x34, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x2C, 0x20, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x3D, 0x6E, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6C, 0x2C, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x4B, 0x65, 0x79, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x3D, 0x62, 0x37, 0x37, 0x61, 0x35, 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39, 0x05, 0x01, 0x00, 0x00, 0x00, 0x2C, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x4D, 0x6F, 0x64, 0x65, 0x6C, 0x2E, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x73, 0x2E, 0x42, 0x6F, 0x6F, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x78, 0x74, 0x02, 0x00, 0x00, 0x00, 0x01, 0x4B, 0x01, 0x54, 0x00, 0x01, 0x03, 0x02, 0x00, 0x00, 0x00, 0x54, 0x06, 0x03, 0x00, 0x00, 0x00, 0x98, 0x01, 0x50, 0x46, 0x56, 0x7A, 0x5A, 0x58, 0x4A, 0x4F, 0x59, 0x57, 0x31, 0x6C, 0x55, 0x32, 0x56, 0x6A, 0x64, 0x58, 0x4A, 0x70, 0x64, 0x48, 0x6C, 0x55, 0x62, 0x32, 0x74, 0x6C, 0x62, 0x69, 0x42, 0x4A, 0x5A, 0x44, 0x30, 0x69, 0x64, 0x58, 0x56, 0x70, 0x5A, 0x43, 0x30, 0x35, 0x4D, 0x6A, 0x64, 0x6A, 0x4D, 0x47, 0x49, 0x35, 0x4F, 0x43, 0x31, 0x69, 0x59, 0x54, 0x45, 0x34, 0x4C, 0x54, 0x51, 0x35, 0x5A, 0x44, 0x49, 0x74, 0x59, 0x54, 0x59, 0x31, 0x4D, 0x79, 0x30, 0x7A, 0x4D, 0x44, 0x5A, 0x6B, 0x4E, 0x6A, 0x42, 0x6D, 0x4F, 0x44, 0x55, 0x33, 0x4E, 0x54, 0x45, 0x74, 0x4D, 0x79, 0x49, 0x67, 0x56, 0x58, 0x4E, 0x6C, 0x63, 0x6D, 0x35, 0x68, 0x62, 0x57, 0x55, 0x39, 0x49, 0x6E, 0x56, 0x7A, 0x78, 0x6F, 0x35, 0x79, 0x49, 0x69, 0x42, 0x51, 0x59, 0x58, 0x4E, 0x7A, 0x64, 0x32, 0x39, 0x79, 0x5A, 0x44, 0x30, 0x69, 0x63, 0x47, 0x46, 0x7A, 0x63, 0x38, 0x4B, 0x39, 0x64, 0x32, 0x39, 0x79, 0x5A, 0x43, 0x49, 0x76, 0x50, 0x67, 0x3D, 0x3D, 0x0B };
|
||||
|
||||
[Test]
|
||||
public void Ctor_StringToken_Works ()
|
||||
{
|
||||
BootstrapContext bootstrapContext = new BootstrapContext ("token");
|
||||
|
||||
Assert.AreEqual ("token", bootstrapContext.Token, "#1");
|
||||
Assert.IsNull (bootstrapContext.TokenBytes, "#2");
|
||||
Assert.IsNull (bootstrapContext.SecurityToken, "#3");
|
||||
Assert.IsNull (bootstrapContext.SecurityTokenHandler, "#4");
|
||||
}
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Ctor_StringToken_NullToken_Throws ()
|
||||
{
|
||||
BootstrapContext bootstrapContext = new BootstrapContext ((string)null);
|
||||
Assert.Fail ("Should have thrown");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Serialize_StringToken_Works ()
|
||||
{
|
||||
BootstrapContext bootstrapContext = new BootstrapContext ("token");
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter ();
|
||||
using (var s = new MemoryStream ()) {
|
||||
binaryFormatter.Serialize (s, bootstrapContext);
|
||||
s.Position = 0;
|
||||
BootstrapContext bootstrapContext2 = binaryFormatter.Deserialize (s) as BootstrapContext;
|
||||
Assert.IsNotNull (bootstrapContext2, "#1");
|
||||
Assert.AreEqual (bootstrapContext.Token, bootstrapContext2.Token, "#2");
|
||||
Assert.AreEqual (bootstrapContext.TokenBytes, bootstrapContext2.TokenBytes, "#3");
|
||||
Assert.AreEqual (bootstrapContext.SecurityToken, bootstrapContext2.SecurityToken, "#4");
|
||||
Assert.AreEqual (bootstrapContext.SecurityTokenHandler, bootstrapContext2.SecurityTokenHandler, "#5");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Deserialize_StringToken_Works ()
|
||||
{
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter ();
|
||||
using (var s = new MemoryStream (SerializedBootstrapContextString)) {
|
||||
BootstrapContext bootstrapContext = binaryFormatter.Deserialize (s) as BootstrapContext;
|
||||
Assert.IsNotNull (bootstrapContext, "#1");
|
||||
Assert.AreEqual ("token", bootstrapContext.Token, "#2");
|
||||
Assert.IsNull (bootstrapContext.TokenBytes, "#3");
|
||||
Assert.IsNull (bootstrapContext.SecurityToken, "#4");
|
||||
Assert.IsNull (bootstrapContext.SecurityTokenHandler, "#5");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_ByteArrayToken_Works ()
|
||||
{
|
||||
BootstrapContext bootstrapContext = new BootstrapContext (new byte [] { 0x01 });
|
||||
|
||||
Assert.IsNotNull (bootstrapContext.TokenBytes, "#1");
|
||||
Assert.AreEqual (1, bootstrapContext.TokenBytes.Length, "#2");
|
||||
Assert.AreEqual (1, bootstrapContext.TokenBytes [0], "#3");
|
||||
Assert.IsNull (bootstrapContext.Token, "#4");
|
||||
Assert.IsNull (bootstrapContext.SecurityToken, "#5");
|
||||
Assert.IsNull (bootstrapContext.SecurityTokenHandler, "#6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Ctor_ByteArrayToken_NullToken_Throws ()
|
||||
{
|
||||
BootstrapContext bootstrapContext = new BootstrapContext ((byte [])null);
|
||||
Assert.Fail ("Should have thrown");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Serialize_ByteArrayToken_Works ()
|
||||
{
|
||||
BootstrapContext bootstrapContext = new BootstrapContext (new byte [] { 0x1 });
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter ();
|
||||
using (var s = new MemoryStream ()) {
|
||||
binaryFormatter.Serialize (s, bootstrapContext);
|
||||
s.Position = 0;
|
||||
BootstrapContext bootstrapContext2 = binaryFormatter.Deserialize (s) as BootstrapContext;
|
||||
Assert.IsNotNull (bootstrapContext2, "#1");
|
||||
Assert.AreEqual (bootstrapContext.Token, bootstrapContext2.Token, "#2");
|
||||
Assert.AreEqual (bootstrapContext.TokenBytes, bootstrapContext2.TokenBytes, "#3");
|
||||
Assert.AreEqual (bootstrapContext.SecurityToken, bootstrapContext2.SecurityToken, "#4");
|
||||
Assert.AreEqual (bootstrapContext.SecurityTokenHandler, bootstrapContext2.SecurityTokenHandler, "#5");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Deserialize_ByteArrayToken_Works ()
|
||||
{
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter ();
|
||||
using (var s = new MemoryStream (SerializedBootstrapContextByteArray)) {
|
||||
BootstrapContext bootstrapContext = binaryFormatter.Deserialize (s) as BootstrapContext;
|
||||
Assert.IsNotNull (bootstrapContext, "#1");
|
||||
Assert.IsNotNull (bootstrapContext.TokenBytes, "#2");
|
||||
Assert.AreEqual (1, bootstrapContext.TokenBytes.Length, "#3");
|
||||
Assert.AreEqual (1, bootstrapContext.TokenBytes [0], "#4");
|
||||
Assert.IsNull (bootstrapContext.Token, "#5");
|
||||
Assert.IsNull (bootstrapContext.SecurityToken, "#6");
|
||||
Assert.IsNull (bootstrapContext.SecurityTokenHandler, "#7");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ctor_SecurityToken_Works ()
|
||||
{
|
||||
var securityToken = new UserNameSecurityToken (user, password);
|
||||
var securityTokenHandler = new SimpleSecurityTokenHandler ();
|
||||
BootstrapContext bootstrapContext = new BootstrapContext (securityToken, securityTokenHandler);
|
||||
|
||||
Assert.IsNotNull (bootstrapContext.SecurityToken, "#1");
|
||||
Assert.AreEqual (user, securityToken.UserName, "#2");
|
||||
Assert.AreEqual (password, securityToken.Password, "#3");
|
||||
Assert.AreEqual (securityTokenHandler, bootstrapContext.SecurityTokenHandler, "#4");
|
||||
|
||||
Assert.IsNull (bootstrapContext.Token, "#5");
|
||||
Assert.IsNull (bootstrapContext.TokenBytes, "#6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Ctor_SecurityToken_NullToken_Throws ()
|
||||
{
|
||||
BootstrapContext bootstrapContext = new BootstrapContext (null, new SimpleSecurityTokenHandler ());
|
||||
Assert.Fail ("Should have thrown");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Ctor_SecurityToken_NullHandler_Throws ()
|
||||
{
|
||||
BootstrapContext bootstrapContext = new BootstrapContext (new UserNameSecurityToken ("user", "password"), null);
|
||||
Assert.Fail ("Should have thrown");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Serialize_SecurityTokenAndHandler_Works ()
|
||||
{
|
||||
var securityToken = new UserNameSecurityToken (user, password, "uuid-927c0b98-ba18-49d2-a653-306d60f85751-3");
|
||||
var securityTokenHandler = new SimpleSecurityTokenHandler ();
|
||||
BootstrapContext bootstrapContext = new BootstrapContext (securityToken, securityTokenHandler);
|
||||
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter ();
|
||||
using (var s = new MemoryStream ()) {
|
||||
binaryFormatter.Serialize (s, bootstrapContext);
|
||||
s.Position = 0;
|
||||
BootstrapContext bootstrapContext2 = binaryFormatter.Deserialize (s) as BootstrapContext;
|
||||
Assert.IsNotNull (bootstrapContext2, "#1");
|
||||
// Deserialize does not restore the SecurityToken, but restores into the Token.
|
||||
Assert.IsNotNull (bootstrapContext2.Token, "#3");
|
||||
// We replace ' /' by '/' to accomodate the xml writer differences between mono and .net
|
||||
Assert.AreEqual (SerializedBootstrapContextSecurityTokenString.Replace (" /", "/"), bootstrapContext2.Token.Replace (" /", "/"), "#2");
|
||||
Assert.AreEqual (bootstrapContext.TokenBytes, bootstrapContext2.TokenBytes, "#3");
|
||||
Assert.IsNull (bootstrapContext2.SecurityToken, "#4");
|
||||
Assert.IsNull (bootstrapContext2.SecurityTokenHandler, "#5");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Deserialize_SecurityTokenAndHandler_Works ()
|
||||
{
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter ();
|
||||
using (var s = new MemoryStream (SerializedBootstrapContextSecurityToken)) {
|
||||
BootstrapContext bootstrapContext = binaryFormatter.Deserialize (s) as BootstrapContext;
|
||||
Assert.IsNotNull (bootstrapContext, "#1");
|
||||
Assert.AreEqual (SerializedBootstrapContextSecurityTokenString, bootstrapContext.Token, "#2");
|
||||
Assert.IsNull (bootstrapContext.SecurityToken, "#3");
|
||||
Assert.IsNull (bootstrapContext.SecurityTokenHandler, "#4");
|
||||
Assert.IsNull (bootstrapContext.TokenBytes, "#5");
|
||||
}
|
||||
}
|
||||
|
||||
private static void DumpAsText (byte [] data)
|
||||
{
|
||||
Console.WriteLine ("{0}", Encoding.ASCII.GetString (data));
|
||||
}
|
||||
|
||||
private static void Dump (byte [] data)
|
||||
{
|
||||
var sb = new StringBuilder ();
|
||||
sb.Append ("new byte[] { ");
|
||||
bool first = true;
|
||||
foreach (byte b in data) {
|
||||
if (!first)
|
||||
sb.Append (", ");
|
||||
else
|
||||
first = false;
|
||||
sb.AppendFormat ("0x{0:X2}", b);
|
||||
}
|
||||
sb.Append (" };");
|
||||
Console.WriteLine (sb.ToString ());
|
||||
}
|
||||
|
||||
private class SimpleSecurityTokenHandler : SecurityTokenHandler {
|
||||
public override string [] GetTokenTypeIdentifiers ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public override Type TokenType {
|
||||
get { return typeof (UserNameSecurityToken); }
|
||||
}
|
||||
|
||||
public override bool CanWriteToken {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override void WriteToken (XmlWriter writer, SecurityToken token)
|
||||
{
|
||||
UserNameSecurityToken unst = token as UserNameSecurityToken;
|
||||
if (unst == null)
|
||||
throw new ArgumentException ("Token must be of type UserNameSecurityToken", "token");
|
||||
writer.WriteStartElement ("UserNameSecurityToken");
|
||||
writer.WriteAttributeString ("Id", unst.Id);
|
||||
writer.WriteAttributeString ("Username", unst.UserName);
|
||||
writer.WriteAttributeString ("Password", unst.Password);
|
||||
writer.WriteEndElement ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -26,28 +26,28 @@
|
||||
// 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.ComponentModel;
|
||||
|
||||
namespace System.Management
|
||||
{
|
||||
[MonoTODO ("System.Management is not implemented")]
|
||||
[ToolboxItem (false)]
|
||||
public class ManagementObjectSearcher : Component
|
||||
{
|
||||
ObjectQuery mQueryObject;
|
||||
|
||||
public ManagementObjectSearcher ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
mQueryObject = new ObjectQuery ();
|
||||
}
|
||||
|
||||
public ManagementObjectSearcher (ObjectQuery query)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
mQueryObject = (ObjectQuery)query.Clone ();
|
||||
}
|
||||
|
||||
public ManagementObjectSearcher (string queryString)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
mQueryObject = new ObjectQuery (queryString);
|
||||
}
|
||||
|
||||
public ManagementObjectSearcher (ManagementScope scope, ObjectQuery query)
|
||||
@@ -81,10 +81,10 @@ namespace System.Management
|
||||
|
||||
public ObjectQuery Query {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
return mQueryObject;
|
||||
}
|
||||
set {
|
||||
throw new NotImplementedException ();
|
||||
mQueryObject = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -257,6 +257,11 @@ namespace System.Net.Http.Headers
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Lexer.IsValidCharacter (ch) || ch == '*' || ch == '?' || ch == '%') {
|
||||
sb.Append (Uri.HexEscape (ch));
|
||||
continue;
|
||||
}
|
||||
|
||||
sb.Append (ch);
|
||||
}
|
||||
|
||||
|
||||
@@ -193,13 +193,18 @@ namespace System.Net.Http.Headers
|
||||
//
|
||||
for (; i < input.Length; ++i) {
|
||||
char s = input[i];
|
||||
if (s > last_token_char || !token_chars[s])
|
||||
if (!IsValidCharacter (s))
|
||||
return false;
|
||||
}
|
||||
|
||||
return i > 0;
|
||||
}
|
||||
|
||||
public static bool IsValidCharacter (char input)
|
||||
{
|
||||
return input <= last_token_char && token_chars[input];
|
||||
}
|
||||
|
||||
public void EatChar ()
|
||||
{
|
||||
++pos;
|
||||
|
||||
+4
-1
@@ -237,8 +237,11 @@ namespace MonoTests.System.Net.Http.Headers
|
||||
value.FileNameStar = "č";
|
||||
Assert.AreEqual ("č", value.FileNameStar, "#11");
|
||||
Assert.AreEqual (new NameValueHeaderValue ("filename*", "utf-8''%C4%8D"), value.Parameters.First (), "#12");
|
||||
}
|
||||
|
||||
value.FileNameStar = "@x*\\%?.txt";
|
||||
Assert.AreEqual ("@x*\\%?.txt", value.FileNameStar, "#21");
|
||||
Assert.AreEqual (new NameValueHeaderValue ("filename*", "utf-8''%40x%2A%5C%25%3F.txt"), value.Parameters.First (), "#22");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Properties_Name ()
|
||||
|
||||
+11
-3
@@ -84,7 +84,17 @@ namespace System.Runtime.Serialization.Json
|
||||
throw new ArgumentOutOfRangeException ("maxItemsInObjectGraph");
|
||||
|
||||
this.type = type;
|
||||
known_types = new ReadOnlyCollection<Type> (knownTypes != null ? knownTypes.ToArray () : Type.EmptyTypes);
|
||||
|
||||
var knownTypesFromAttributes = new List<Type> ();
|
||||
|
||||
foreach (var attr in type.GetCustomAttributes (typeof (KnownTypeAttribute), false))
|
||||
knownTypesFromAttributes.Add ((attr as KnownTypeAttribute).Type);
|
||||
|
||||
if (knownTypes != null)
|
||||
knownTypesFromAttributes.AddRange (knownTypes);
|
||||
|
||||
known_types = new ReadOnlyCollection<Type> (knownTypesFromAttributes);
|
||||
|
||||
root = rootName;
|
||||
max_items = maxItemsInObjectGraph;
|
||||
ignore_extension = ignoreExtensionDataObject;
|
||||
@@ -134,8 +144,6 @@ namespace System.Runtime.Serialization.Json
|
||||
public bool IgnoreExtensionDataObject {
|
||||
get { return ignore_extension; }
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public ReadOnlyCollection<Type> KnownTypes {
|
||||
get { return known_types; }
|
||||
}
|
||||
|
||||
+25
-17
@@ -182,8 +182,18 @@ namespace System.Runtime.Serialization.Json
|
||||
if (ct != null) {
|
||||
return DeserializeGenericCollection (type, ct, instance);
|
||||
} else {
|
||||
TypeMap map = GetTypeMap (type);
|
||||
return map.Deserialize (this, instance);
|
||||
string typeHint = reader.GetAttribute ("__type");
|
||||
if (typeHint != null) {
|
||||
// this might be a derived & known type. We allow it when it's both.
|
||||
Type exactType = GetRuntimeType (typeHint, type);
|
||||
if (exactType == null)
|
||||
throw SerializationError (String.Format ("Cannot load type '{0}'", typeHint));
|
||||
TypeMap map = GetTypeMap (exactType);
|
||||
return map.Deserialize (this, instance);
|
||||
} else { // no type hint
|
||||
TypeMap map = GetTypeMap (type);
|
||||
return map.Deserialize (this, instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -198,24 +208,22 @@ namespace System.Runtime.Serialization.Json
|
||||
}
|
||||
|
||||
|
||||
Type GetRuntimeType (string name)
|
||||
Type GetRuntimeType (string name, Type baseType)
|
||||
{
|
||||
name = ToRuntimeTypeName (name);
|
||||
string properName = ToRuntimeTypeName (name);
|
||||
|
||||
if (baseType != null && baseType.FullName.Equals (properName))
|
||||
return baseType;
|
||||
|
||||
if (serializer.KnownTypes != null)
|
||||
foreach (Type t in serializer.KnownTypes)
|
||||
if (t.FullName == name)
|
||||
if (t.FullName.Equals (properName))
|
||||
return t;
|
||||
var ret = root_type.Assembly.GetType (name, false) ?? Type.GetType (name, false);
|
||||
if (ret != null)
|
||||
return ret;
|
||||
|
||||
// We probably have to iterate all the existing
|
||||
// assemblies that are loaded in current domain.
|
||||
foreach (var ass in AppDomain.CurrentDomain.GetAssemblies ()) {
|
||||
ret = ass.GetType (name, false);
|
||||
if (ret != null)
|
||||
return ret;
|
||||
}
|
||||
if (baseType != null)
|
||||
foreach (var attr in baseType.GetCustomAttributes (typeof (KnownTypeAttribute), false))
|
||||
if ((attr as KnownTypeAttribute).Type.FullName.Equals (properName))
|
||||
return (attr as KnownTypeAttribute).Type;
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -230,7 +238,7 @@ namespace System.Runtime.Serialization.Json
|
||||
case "object":
|
||||
string runtimeType = reader.GetAttribute ("__type");
|
||||
if (runtimeType != null) {
|
||||
Type t = GetRuntimeType (runtimeType);
|
||||
Type t = GetRuntimeType (runtimeType, null);
|
||||
if (t == null)
|
||||
throw SerializationError (String.Format ("Cannot load type '{0}'", runtimeType));
|
||||
return ReadObject (t);
|
||||
@@ -264,7 +272,7 @@ namespace System.Runtime.Serialization.Json
|
||||
if (double.TryParse (v, NumberStyles.None, CultureInfo.InvariantCulture, out dbl))
|
||||
return dbl;
|
||||
decimal dec;
|
||||
if (decimal.TryParse (v, NumberStyles.None, CultureInfo.InvariantCulture, out dec))
|
||||
if (decimal.TryParse (v, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out dec))
|
||||
return dec;
|
||||
throw SerializationError (String.Format ("Invalid JSON input: {0}", v));
|
||||
default:
|
||||
|
||||
+2
-3
@@ -203,10 +203,9 @@ namespace System.ServiceModel.Syndication
|
||||
Item.Links.Add (l);
|
||||
continue;
|
||||
case "guid":
|
||||
Item.Id = reader.ReadElementContentAsString ();
|
||||
if (reader.GetAttribute ("isPermaLink") == "true")
|
||||
Item.AddPermalink (CreateUri (reader.ReadElementContentAsString ()));
|
||||
else
|
||||
Item.Id = reader.ReadElementContentAsString ();
|
||||
Item.AddPermalink (CreateUri (Item.Id));
|
||||
continue;
|
||||
case "pubDate":
|
||||
Item.PublishDate = FromRFC822DateString (reader.ReadElementContentAsString ());
|
||||
|
||||
+89
@@ -1191,6 +1191,15 @@ namespace MonoTests.System.Runtime.Serialization.Json
|
||||
return ser.ReadObject (xr);
|
||||
}
|
||||
|
||||
public T Deserialize<T>(string json)
|
||||
{
|
||||
var bytes = Encoding.Unicode.GetBytes (json);
|
||||
using (MemoryStream stream = new MemoryStream (bytes)) {
|
||||
var serializer = new DataContractJsonSerializer (typeof(T));
|
||||
return (T)serializer.ReadObject (stream);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsStartObject ()
|
||||
{
|
||||
@@ -1819,6 +1828,50 @@ namespace MonoTests.System.Runtime.Serialization.Json
|
||||
serializer.WriteObject (stream, o);
|
||||
}
|
||||
|
||||
// properly deserialize object with a polymorphic property (known derived type)
|
||||
[Test]
|
||||
public void Bug23058()
|
||||
{
|
||||
string serializedObj = @"{""PolymorphicProperty"":{""__type"":""KnownDerivedType:#MonoTests.System.Runtime.Serialization.Json"",""BaseTypeProperty"":""Base"",""DerivedProperty"":""Derived 1""},""Name"":""Parent2""}";
|
||||
ParentType deserializedObj = Deserialize<ParentType> (serializedObj);
|
||||
|
||||
Assert.AreEqual (deserializedObj.PolymorphicProperty.GetType ().FullName, "MonoTests.System.Runtime.Serialization.Json.KnownDerivedType");
|
||||
Assert.AreEqual (deserializedObj.PolymorphicProperty.BaseTypeProperty, "Base");
|
||||
Assert.AreEqual ((deserializedObj.PolymorphicProperty as KnownDerivedType).DerivedProperty, "Derived 1");
|
||||
Assert.AreEqual (deserializedObj.Name, "Parent2");
|
||||
}
|
||||
|
||||
// properly deserialize object with a polymorphic property (base type with __type hint)
|
||||
[Test]
|
||||
public void DeserializeBaseTypePropHint()
|
||||
{
|
||||
string serializedObj = @"{""PolymorphicProperty"":{""__type"":""BaseType:#MonoTests.System.Runtime.Serialization.Json"",""BaseTypeProperty"":""Base""},""Name"":""Parent2""}";
|
||||
ParentType deserializedObj = Deserialize<ParentType> (serializedObj);
|
||||
|
||||
Assert.AreEqual (deserializedObj.PolymorphicProperty.GetType ().FullName, "MonoTests.System.Runtime.Serialization.Json.BaseType");
|
||||
Assert.AreEqual (deserializedObj.PolymorphicProperty.BaseTypeProperty, "Base");
|
||||
}
|
||||
|
||||
// properly deserialize object with a polymorphic property (base type with __type hint)
|
||||
[Test]
|
||||
public void DeserializeBaseTypePropNoHint()
|
||||
{
|
||||
string serializedObj = @"{""PolymorphicProperty"":{""BaseTypeProperty"":""Base""},""Name"":""Parent2""}";
|
||||
ParentType deserializedObj = Deserialize<ParentType> (serializedObj);
|
||||
|
||||
Assert.AreEqual (deserializedObj.PolymorphicProperty.GetType ().FullName, "MonoTests.System.Runtime.Serialization.Json.BaseType");
|
||||
Assert.AreEqual (deserializedObj.PolymorphicProperty.BaseTypeProperty, "Base");
|
||||
}
|
||||
|
||||
// properly fail deserializing object with a polymorphic property (unknown derived type)
|
||||
[ExpectedException (typeof (SerializationException))]
|
||||
[Test]
|
||||
public void FailDeserializingUnknownTypeProp()
|
||||
{
|
||||
string serializedObj = @"{""PolymorphicProperty"":{""__type"":""UnknownDerivedType:#MonoTests.System.Runtime.Serialization.Json"",""BaseTypeProperty"":""Base"",""DerivedProperty"":""Derived 1""},""Name"":""Parent2""}";
|
||||
ParentType deserializedObj = Deserialize<ParentType> (serializedObj);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -2037,6 +2090,42 @@ namespace MonoTests.System.Runtime.Serialization.Json
|
||||
public long CodedServerTimeUTC { get; set; }
|
||||
public DateTime ServerTimeUTC { get; set; }
|
||||
}
|
||||
|
||||
#region polymorphism test helper classes
|
||||
|
||||
[DataContract]
|
||||
[KnownType (typeof (KnownDerivedType))]
|
||||
public class ParentType
|
||||
{
|
||||
[DataMember]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public BaseType PolymorphicProperty { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class BaseType
|
||||
{
|
||||
[DataMember]
|
||||
public string BaseTypeProperty { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class KnownDerivedType : BaseType
|
||||
{
|
||||
[DataMemberAttribute]
|
||||
public string DerivedProperty { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class UnknownDerivedType : BaseType
|
||||
{
|
||||
[DataMember]
|
||||
public string DerivedProperty { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
|
||||
+11
@@ -855,5 +855,16 @@ namespace MonoTests.System.Runtime.Serialization.Json
|
||||
r.ReadStartElement ();
|
||||
r.Read ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReadNumberAsObject ()
|
||||
{
|
||||
const double testValue = 42.42D;
|
||||
var serializer = new DataContractJsonSerializer (typeof (object));
|
||||
var serializedStream = GetInput (testValue.ToString (CultureInfo.InvariantCulture));
|
||||
var deserializedValue = serializer.ReadObject (serializedStream);
|
||||
Assert.AreEqual (typeof (decimal), deserializedValue.GetType ());
|
||||
Assert.AreEqual (testValue, (decimal) deserializedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -351,6 +351,24 @@ namespace MonoTests.System.ServiceModel.Syndication
|
||||
{
|
||||
Assert.IsNull (((IXmlSerializable) new Rss20ItemFormatter ()).GetSchema ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReadFromGuidPermaLink ()
|
||||
{
|
||||
const string xml1 = "<item><guid isPermaLink=\"false\">urn:myid</guid><description /></item>";
|
||||
using (XmlReader r = CreateReader (xml1)) {
|
||||
var rss = new Rss20ItemFormatter ();
|
||||
rss.ReadFrom (r);
|
||||
Assert.AreEqual ("urn:myid", rss.Item.Id);
|
||||
}
|
||||
|
||||
const string xml2 = "<item><guid isPermaLink=\"true\">urn:myid</guid><description /></item>";
|
||||
using (XmlReader r = CreateReader (xml2)) {
|
||||
var rss = new Rss20ItemFormatter ();
|
||||
rss.ReadFrom (r);
|
||||
Assert.AreEqual ("urn:myid", rss.Item.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -136,6 +136,9 @@ namespace System.Web
|
||||
|
||||
public virtual int TotalBytes { get { NotImplemented (); return 0; } }
|
||||
|
||||
#if NET_4_5
|
||||
public virtual ReadEntityBodyMode ReadEntityBodyMode { get { NotImplemented(); return ReadEntityBodyMode.Classic; } }
|
||||
#endif
|
||||
public virtual Uri Url { get { NotImplemented (); return null; } }
|
||||
|
||||
public virtual Uri UrlReferrer { get { NotImplemented (); return null; } }
|
||||
@@ -148,6 +151,12 @@ namespace System.Web
|
||||
|
||||
public virtual string [] UserLanguages { get { NotImplemented (); return null; } }
|
||||
|
||||
#if NET_4_5
|
||||
public virtual void Abort ()
|
||||
{
|
||||
NotImplemented();
|
||||
}
|
||||
#endif
|
||||
|
||||
public virtual byte [] BinaryRead (int count)
|
||||
{
|
||||
|
||||
@@ -232,6 +232,13 @@ namespace System.Web
|
||||
get { return w.UserLanguages; }
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public void Abort ()
|
||||
{
|
||||
w.WorkerRequest.CloseConnection();
|
||||
}
|
||||
#endif
|
||||
|
||||
public override byte [] BinaryRead (int count)
|
||||
{
|
||||
return w.BinaryRead (count);
|
||||
|
||||
@@ -105,6 +105,10 @@ namespace System.Web
|
||||
|
||||
public virtual bool SuppressContent { get { NotImplemented (); return false; } set { NotImplemented (); } }
|
||||
|
||||
#if NET_4_5
|
||||
public virtual bool SuppressFormsAuthenticationRedirect { get { NotImplemented (); return false; } set { NotImplemented (); } }
|
||||
#endif
|
||||
|
||||
public virtual bool TrySkipIisCustomErrors { get { NotImplemented (); return false; } set { NotImplemented (); } }
|
||||
|
||||
|
||||
|
||||
@@ -169,6 +169,13 @@ namespace System.Web
|
||||
set { w.SuppressContent = value; }
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public override bool SuppressFormsAuthenticationRedirect {
|
||||
get { return w.SuppressFormsAuthenticationRedirect; }
|
||||
set { w.SuppressFormsAuthenticationRedirect = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public override bool TrySkipIisCustomErrors {
|
||||
get { return w.TrySkipIisCustomErrors; }
|
||||
set { w.TrySkipIisCustomErrors = value; }
|
||||
|
||||
@@ -1321,6 +1321,7 @@
|
||||
<Compile Include="System.Web\ProcessShutdownReason.cs" />
|
||||
<Compile Include="System.Web\ProcessStatus.cs" />
|
||||
<Compile Include="System.Web\QueueManager.cs" />
|
||||
<Compile Include="System.Web\ReadEntityBodyMode.cs" />
|
||||
<Compile Include="System.Web\RequestNotification.cs" />
|
||||
<Compile Include="System.Web\RequestNotificationStatus.cs" />
|
||||
<Compile Include="System.Web\ServerVariablesCollection.cs" />
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace System.Web.Configuration {
|
||||
static readonly char[] pathTrimChars = { '/' };
|
||||
static readonly object suppressAppReloadLock = new object ();
|
||||
static readonly object saveLocationsCacheLock = new object ();
|
||||
static readonly object getSectionLock = new object ();
|
||||
|
||||
// See comment for the cacheLock field at top of System.Web.Caching/Cache.cs
|
||||
static readonly ReaderWriterLockSlim sectionCacheLock;
|
||||
@@ -517,7 +518,10 @@ namespace System.Web.Configuration {
|
||||
cachePath = path;
|
||||
}
|
||||
|
||||
ConfigurationSection section = c.GetSection (sectionName);
|
||||
ConfigurationSection section;
|
||||
lock (getSectionLock) {
|
||||
section = c.GetSection (sectionName);
|
||||
}
|
||||
if (section == null)
|
||||
return null;
|
||||
|
||||
@@ -529,7 +533,7 @@ namespace System.Web.Configuration {
|
||||
value = collection;
|
||||
}
|
||||
#else
|
||||
object value = SettingsMappingManager.MapSection (get_runtime_object.Invoke (section, new object [0]));
|
||||
object value = SettingsMappingManager.MapSection (section.GetRuntimeObject ());
|
||||
#endif
|
||||
if (cachePath != null)
|
||||
cacheKey = baseCacheKey ^ cachePath.GetHashCode ();
|
||||
@@ -677,7 +681,9 @@ namespace System.Web.Configuration {
|
||||
configurations.Remove (GetCurrentPath (ctx));
|
||||
}
|
||||
|
||||
#if TARGET_J2EE
|
||||
readonly static MethodInfo get_runtime_object = typeof (ConfigurationSection).GetMethod ("GetRuntimeObject", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
#endif
|
||||
|
||||
public static object GetWebApplicationSection (string sectionName)
|
||||
{
|
||||
|
||||
@@ -160,7 +160,9 @@ namespace System.Web.Hosting {
|
||||
{
|
||||
if (obj == null)
|
||||
throw new ArgumentNullException ("obj");
|
||||
Host.RegisterObject (obj, false);
|
||||
|
||||
if (Host != null)
|
||||
Host.RegisterObject (obj, false);
|
||||
}
|
||||
|
||||
public static void RegisterVirtualPathProvider (VirtualPathProvider virtualPathProvider)
|
||||
@@ -200,7 +202,9 @@ namespace System.Web.Hosting {
|
||||
{
|
||||
if (obj == null)
|
||||
throw new ArgumentNullException ("obj");
|
||||
Host.UnregisterObject (obj);
|
||||
|
||||
if (Host != null)
|
||||
Host.UnregisterObject (obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +180,11 @@ namespace System.Web.Security
|
||||
if (context.Response.StatusCode != 401 || context.Request.QueryString ["ReturnUrl"] != null)
|
||||
return;
|
||||
|
||||
#if NET_4_5
|
||||
if (context.Response.StatusCode == 401 && context.Response.SuppressFormsAuthenticationRedirect)
|
||||
return;
|
||||
#endif
|
||||
|
||||
string loginPage;
|
||||
InitConfig (context);
|
||||
#if NET_2_0
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace System.Web.Security
|
||||
|
||||
internal void UpdateUser ()
|
||||
{
|
||||
MembershipUser newUser = Provider.GetUser (name, false);
|
||||
MembershipUser newUser = Provider.GetUser (UserName, false);
|
||||
UpdateSelf (newUser);
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +230,10 @@ namespace System.Web
|
||||
}
|
||||
} catch (Exception e) {
|
||||
initialization_exception = e;
|
||||
Console.Error.WriteLine("Exception while initOnce: "+e.ToString());
|
||||
// Once initialization_exception != null, we always respond with this exception
|
||||
// You have to restart the HttpApplication to "unlock" it
|
||||
Console.Error.WriteLine("Please restart your app to unlock it");
|
||||
} finally {
|
||||
if (mustNullContext)
|
||||
context = null;
|
||||
@@ -1549,6 +1553,7 @@ namespace System.Web
|
||||
if (initialization_exception != null) {
|
||||
Exception e = initialization_exception;
|
||||
HttpException exc = HttpException.NewWithCode (String.Empty, e, WebEventCodes.RuntimeErrorRequestAbort);
|
||||
context.Response.StatusCode = 500;
|
||||
FinalErrorWrite (context.Response, exc.GetHtmlErrorMessage ());
|
||||
PipelineDone ();
|
||||
return;
|
||||
|
||||
@@ -400,6 +400,13 @@ namespace System.Web
|
||||
set;
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public bool SuppressFormsAuthenticationRedirect {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
#endif
|
||||
|
||||
public bool TrySkipIisCustomErrors {
|
||||
get;
|
||||
set;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace System.Web {
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
string [] keys = AllKeys;
|
||||
for (int i = 0; i < count; i++) {
|
||||
sb.AppendFormat ("{0}={1}&", keys [i], this [keys [i]]);
|
||||
sb.AppendFormat ("{0}={1}&", keys [i], UrlEncode (this [keys [i]]));
|
||||
}
|
||||
if (sb.Length > 0)
|
||||
sb.Length--;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// ReadEntityBodyMode.cs
|
||||
//
|
||||
// Author: Martin Thwaites ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Martin Thwaites
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// 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.Web {
|
||||
public enum ReadEntityBodyMode {
|
||||
None,
|
||||
Classic,
|
||||
Bufferless,
|
||||
Buffered,
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,10 @@ using System.Web.UI;
|
||||
using MonoTests.SystemWeb.Framework;
|
||||
|
||||
namespace MonoTests.System.Web.Hosting {
|
||||
public class MyRegisteredObject : IRegisteredObject {
|
||||
public void Stop(bool immediate) {}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class HostingEnvironmentTest {
|
||||
[Test]
|
||||
@@ -105,6 +109,15 @@ namespace MonoTests.System.Web.Hosting {
|
||||
{
|
||||
Assert.IsNull (HostingEnvironment.MapPath ("hola"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RegisterAndUnregisterObject ()
|
||||
{
|
||||
var registered = new MyRegisteredObject ();
|
||||
|
||||
HostingEnvironment.RegisterObject (registered);
|
||||
HostingEnvironment.UnregisterObject (registered);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -861,6 +861,15 @@ namespace MonoTests.System.Web {
|
||||
@" ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void ToStringEncoding ()
|
||||
{
|
||||
var queryStringNameValues = HttpUtility.ParseQueryString(string.Empty);
|
||||
queryStringNameValues.Add("ReturnUrl", @"http://localhost/login/authenticate?ReturnUrl=http://localhost/secured_area&__provider__=google");
|
||||
|
||||
var expected = "ReturnUrl=http%3a%2f%2flocalhost%2flogin%2fauthenticate%3fReturnUrl%3dhttp%3a%2f%2flocalhost%2fsecured_area%26__provider__%3dgoogle";
|
||||
Assert.AreEqual (expected, queryStringNameValues.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include net_4_0_System.Web.dll.sources
|
||||
|
||||
System.Web/MimeMapping.cs
|
||||
System.Web/ReadEntityBodyMode.cs
|
||||
|
||||
@@ -1955,14 +1955,12 @@ namespace System.Xml.Serialization
|
||||
{
|
||||
XmlTypeMapMemberElement mem = (XmlTypeMapMemberElement) map.XmlTextCollector;
|
||||
XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) mem.ElementInfo [0];
|
||||
string str = GetStrTempVar ();
|
||||
WriteLine ("string " + str + " = Reader.ReadString();");
|
||||
if (info.TypeData.Type == typeof (string))
|
||||
GenerateSetMemberValue (mem, ob, "ReadString (" + GenerateGetMemberValue (mem, ob, isValueList) + ")", isValueList);
|
||||
GenerateSetMemberValue (mem, ob, str, isValueList);
|
||||
else {
|
||||
WriteLineInd ("{");
|
||||
string str = GetStrTempVar ();
|
||||
WriteLine ("string " + str + " = Reader.ReadString();");
|
||||
GenerateSetMemberValue (mem, ob, GenerateGetValueFromXmlString (str, info.TypeData, info.MappedType, info.IsNullable), isValueList);
|
||||
WriteLineUni ("}");
|
||||
}
|
||||
GenerateEndHook ();
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ namespace System.Xml.Serialization
|
||||
XmlTypeMapMemberElement mem = (XmlTypeMapMemberElement) map.XmlTextCollector;
|
||||
XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) mem.ElementInfo [0];
|
||||
if (info.TypeData.Type == typeof (string))
|
||||
SetMemberValue (mem, ob, ReadString ((string) GetMemberValue (mem, ob, isValueList)), isValueList);
|
||||
SetMemberValue (mem, ob, Reader.ReadString (), isValueList);
|
||||
else
|
||||
SetMemberValue (mem, ob, GetValueFromXmlString (Reader.ReadString(), info.TypeData, info.MappedType), isValueList);
|
||||
}
|
||||
|
||||
@@ -164,11 +164,6 @@ namespace Mono.Xml2
|
||||
InitializeContext (url, context, fragment, fragType);
|
||||
}
|
||||
|
||||
Uri ResolveUri (string url)
|
||||
{
|
||||
return resolver == null ? null : resolver.ResolveUri (null, url);
|
||||
}
|
||||
|
||||
Stream GetStreamFromUrl (string url, out string absoluteUriString)
|
||||
{
|
||||
#if NET_2_1
|
||||
@@ -177,9 +172,13 @@ namespace Mono.Xml2
|
||||
if (url.Length == 0)
|
||||
throw new ArgumentException ("url");
|
||||
#endif
|
||||
Uri uri = ResolveUri (url);
|
||||
//
|
||||
// This needs to work even if resolver is explicitly set to null
|
||||
//
|
||||
var res = resolver ?? new XmlUrlResolver ();
|
||||
var uri = res.ResolveUri (null, url);
|
||||
absoluteUriString = uri != null ? uri.ToString () : String.Empty;
|
||||
return resolver == null ? null : resolver.GetEntity (uri, null, typeof (Stream)) as Stream;
|
||||
return res.GetEntity (uri, null, typeof (Stream)) as Stream;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -717,7 +716,6 @@ namespace Mono.Xml2
|
||||
if (valueCache != null)
|
||||
return valueCache;
|
||||
if (ValueBufferStart >= 0) {
|
||||
//Console.WriteLine (NodeType + " / " + ValueBuffer.Length + " / " + ValueBufferStart + " / " + ValueBufferEnd);
|
||||
valueCache = Reader.valueBuffer.ToString (ValueBufferStart, ValueBufferEnd - ValueBufferStart);
|
||||
return valueCache;
|
||||
}
|
||||
@@ -1801,6 +1799,7 @@ namespace Mono.Xml2
|
||||
value,
|
||||
false);
|
||||
ati.Value = value;
|
||||
ati.ValueTokenStartIndex = ati.ValueTokenEndIndex = currentAttributeValue;
|
||||
attributeCount++;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,6 +254,11 @@ namespace System.Xml
|
||||
get { return entity != null ? ReadState.Interactive : source.ReadState; }
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[MonoTODO]
|
||||
public DtdProcessing DtdProcessing { get; set; }
|
||||
#endif
|
||||
|
||||
#if !NET_4_5
|
||||
public override XmlReaderSettings Settings {
|
||||
get { return base.Settings; }
|
||||
|
||||
@@ -1178,5 +1178,22 @@ namespace MonoTests.System.Xml.TestClasses
|
||||
[XmlArrayItem ("Element")]
|
||||
public List<SimpleClass> Elements;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ClassWithDefaultTextNotNull
|
||||
{
|
||||
[XmlText]
|
||||
public string Value;
|
||||
|
||||
public const string DefaultValue = "NotNull";
|
||||
|
||||
public ClassWithDefaultTextNotNull (string v) {
|
||||
Value = v;
|
||||
}
|
||||
|
||||
public ClassWithDefaultTextNotNull () {
|
||||
Value = DefaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3495,6 +3495,31 @@ namespace MonoTests.System.XmlSerialization
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void TestClassWithDefaultTextNotNullAux (string value, string expected)
|
||||
{
|
||||
var obj = new ClassWithDefaultTextNotNull (value);
|
||||
var ser = new XmlSerializer (typeof (ClassWithDefaultTextNotNull));
|
||||
|
||||
using (var mstream = new MemoryStream ())
|
||||
using (var writer = new XmlTextWriter (mstream, Encoding.ASCII)) {
|
||||
ser.Serialize (writer, obj);
|
||||
|
||||
mstream.Seek (0, SeekOrigin.Begin);
|
||||
using (var reader = new XmlTextReader (mstream)) {
|
||||
var result = (ClassWithDefaultTextNotNull) ser.Deserialize (reader);
|
||||
Assert.AreEqual (expected, result.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClassWithDefaultTextNotNull ()
|
||||
{
|
||||
TestClassWithDefaultTextNotNullAux ("my_text", "my_text");
|
||||
TestClassWithDefaultTextNotNullAux ("", ClassWithDefaultTextNotNull.DefaultValue);
|
||||
TestClassWithDefaultTextNotNullAux (null, ClassWithDefaultTextNotNull.DefaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Test generated serialization code.
|
||||
|
||||
@@ -1382,5 +1382,56 @@ namespace MonoTests.System.Xml
|
||||
var xtr = new XmlTextReader (ms);
|
||||
xtr.Read ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void XmlDeclarationReadAttributeValue ()
|
||||
{
|
||||
const string input = "<?xml version=\"1.0\" encoding=\"utf-8\"?><hello />";
|
||||
var reader = new XmlTextReader (new StringReader (input));
|
||||
reader.WhitespaceHandling = WhitespaceHandling.All;
|
||||
reader.Read ();
|
||||
|
||||
Assert.AreEqual ("1.0", reader.GetAttribute ("version"), "#0");
|
||||
Assert.AreEqual ("utf-8", reader.GetAttribute ("encoding"), "#0-2");
|
||||
|
||||
Assert.IsTrue (reader.MoveToNextAttribute (), "#1");
|
||||
Assert.AreEqual ("1.0", reader.Value, "#1-1");
|
||||
Assert.IsTrue (reader.ReadAttributeValue (), "#2");
|
||||
Assert.AreEqual ("1.0", reader.Value, "#3");
|
||||
Assert.IsFalse (reader.ReadAttributeValue (), "#4");
|
||||
|
||||
Assert.IsTrue (reader.MoveToNextAttribute (), "#5");
|
||||
Assert.AreEqual ("utf-8", reader.Value, "#5-1");
|
||||
Assert.IsTrue (reader.ReadAttributeValue (), "#6");
|
||||
Assert.AreEqual ("utf-8", reader.Value, "#7");
|
||||
Assert.IsFalse (reader.ReadAttributeValue (), "#8");
|
||||
|
||||
Assert.IsFalse (reader.MoveToNextAttribute (), "#9");
|
||||
Assert.IsFalse (reader.ReadAttributeValue (), "#10");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void XmlDeclarationReadAttributeValue2 ()
|
||||
{
|
||||
const string input = "<?xml version=\"1.0\" encoding=\"utf-8\"?><hello />";
|
||||
var reader = new XmlTextReader (new StringReader (input));
|
||||
reader.WhitespaceHandling = WhitespaceHandling.All;
|
||||
reader.Read ();
|
||||
Assert.IsTrue (reader.MoveToNextAttribute (), "#1a");
|
||||
Assert.IsTrue (reader.ReadAttributeValue (), "#1b");
|
||||
Assert.AreEqual (XmlNodeType.Text, reader.NodeType, "#1c");
|
||||
Assert.AreEqual ("1.0", reader.Value, "#1d");
|
||||
Assert.IsFalse (reader.ReadAttributeValue(), "#1e");
|
||||
|
||||
Assert.IsTrue (reader.MoveToNextAttribute(), "#2a");
|
||||
Assert.IsTrue (reader.ReadAttributeValue(), "#2b");
|
||||
Assert.AreEqual (XmlNodeType.Text, reader.NodeType, "#2c");
|
||||
Assert.AreEqual ("utf-8", reader.Value, "#2d");
|
||||
Assert.IsFalse (reader.ReadAttributeValue(), "#2e");
|
||||
|
||||
Assert.IsFalse (reader.MoveToNextAttribute(), "#3");
|
||||
Assert.IsFalse (reader.ReadAttributeValue(), "#4");
|
||||
Assert.AreEqual (XmlNodeType.Text, reader.NodeType, "#5");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
||||
namespace System.Xml.Linq
|
||||
@@ -54,7 +55,9 @@ namespace System.Xml.Linq
|
||||
|
||||
public override void WriteTo (XmlWriter writer)
|
||||
{
|
||||
writer.WriteComment (value);
|
||||
var v = value.Replace ("--", "- -");
|
||||
v = v.LastOrDefault () == '-' ? v.Substring (0, v.Length - 1) +"D;" : v;
|
||||
writer.WriteComment (v);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
System.Xml.Linq/ExtensionsTest.cs
|
||||
System.Xml.Linq/XAttributeTest.cs
|
||||
System.Xml.Linq/XCommentTest.cs
|
||||
System.Xml.Linq/XDocumentTest.cs
|
||||
System.Xml.Linq/XElementTest.cs
|
||||
System.Xml.Linq/XNameTest.cs
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Authors:
|
||||
// Atsushi Enomoto
|
||||
//
|
||||
// Copyright 2014 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using System.Linq;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Xml.Linq
|
||||
{
|
||||
[TestFixture]
|
||||
public class XCommentTest
|
||||
{
|
||||
[Test]
|
||||
public void EscapeSequentialDashes ()
|
||||
{
|
||||
XComment c;
|
||||
|
||||
c = new XComment ("<--foo-->");
|
||||
Assert.AreEqual ("<--foo-->", c.Value, "#1");
|
||||
// bug #23318
|
||||
// Unlike XmlWriter.WriteComment(), XComment.ToString() seems to accept "--" in the value.
|
||||
Assert.AreEqual ("<!--<- -foo- ->-->", c.ToString (), "#2");
|
||||
// make sure if it can be read...
|
||||
XmlReader.Create (new StringReader (c.ToString ())).Read ();
|
||||
|
||||
// The last '-' causes some glitch...
|
||||
c = new XComment ("--foo--");
|
||||
Assert.AreEqual ("--foo--", c.Value, "#3");
|
||||
Assert.AreEqual ("<!--- -foo- D;-->", c.ToString (), "#4");
|
||||
XmlReader.Create (new StringReader (c.ToString ())).Read ();
|
||||
|
||||
// What if <!-- appears in the value?
|
||||
c = new XComment ("<!--foo-->");
|
||||
Assert.AreEqual ("<!--foo-->", c.Value, "#5");
|
||||
Assert.AreEqual ("<!--<!- -foo- ->-->", c.ToString (), "#6");
|
||||
XmlReader.Create (new StringReader (c.ToString ())).Read ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ TEST_MCS_FLAGS = -r:System.Drawing.dll -r:Mono.Security.dll -r:System.Data -r:Sy
|
||||
|
||||
LIB_MCS_FLAGS = -nowarn:618 -d:CONFIGURATION_2_0 -unsafe $(RESOURCE_FILES:%=-resource:%)
|
||||
TEST_MCS_FLAGS += -r:System.Configuration
|
||||
PROFILE_ANY_MOBILE := $(filter monotouch monotouch_runtime monodroid xammaci mobile mobile_static, $(PROFILE))
|
||||
PROFILE_ANY_MOBILE := $(filter monotouch monotouch_runtime monodroid xammac mobile mobile_static, $(PROFILE))
|
||||
|
||||
ifeq (2.1, $(FRAMEWORK_VERSION))
|
||||
LIB_MCS_FLAGS += -d:INSIDE_SYSTEM
|
||||
|
||||
@@ -124,8 +124,12 @@ namespace System.Collections.Concurrent
|
||||
int cachedRemoveId = removeId;
|
||||
int itemsIn = cachedAddId - cachedRemoveId;
|
||||
|
||||
// Check our transaction id against completed stored one
|
||||
if (isComplete.Value && cachedAddId >= completeId)
|
||||
ThrowCompleteException ();
|
||||
|
||||
// If needed, we check and wait that the collection isn't full
|
||||
if (upperBound != -1 && itemsIn > upperBound) {
|
||||
if (upperBound != -1 && itemsIn >= upperBound) {
|
||||
if (millisecondsTimeout == 0)
|
||||
return false;
|
||||
|
||||
@@ -144,10 +148,6 @@ namespace System.Collections.Concurrent
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check our transaction id against completed stored one
|
||||
if (isComplete.Value && cachedAddId >= completeId)
|
||||
ThrowCompleteException ();
|
||||
|
||||
// Validate the steps we have been doing until now
|
||||
if (Interlocked.CompareExchange (ref addId, cachedAddId + 1, cachedAddId) != cachedAddId)
|
||||
continue;
|
||||
@@ -291,30 +291,28 @@ namespace System.Collections.Concurrent
|
||||
|
||||
public static int AddToAny (BlockingCollection<T>[] collections, T item)
|
||||
{
|
||||
CheckArray (collections);
|
||||
int index = 0;
|
||||
foreach (var coll in collections) {
|
||||
try {
|
||||
coll.Add (item);
|
||||
return index;
|
||||
} catch {}
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
return AddToAny (collections, item, CancellationToken.None);
|
||||
}
|
||||
|
||||
public static int AddToAny (BlockingCollection<T>[] collections, T item, CancellationToken cancellationToken)
|
||||
{
|
||||
CheckArray (collections);
|
||||
int index = 0;
|
||||
foreach (var coll in collections) {
|
||||
try {
|
||||
coll.Add (item, cancellationToken);
|
||||
return index;
|
||||
} catch {}
|
||||
index++;
|
||||
WaitHandle[] wait_table = null;
|
||||
while (true) {
|
||||
for (int i = 0; i < collections.Length; ++i) {
|
||||
if (collections [i].TryAdd (item))
|
||||
return i;
|
||||
}
|
||||
cancellationToken.ThrowIfCancellationRequested ();
|
||||
if (wait_table == null) {
|
||||
wait_table = new WaitHandle [collections.Length + 1];
|
||||
for (int i = 0; i < collections.Length; ++i)
|
||||
wait_table [i] = collections [i].mreAdd.WaitHandle;
|
||||
wait_table [collections.Length] = cancellationToken.WaitHandle;
|
||||
}
|
||||
WaitHandle.WaitAny (wait_table);
|
||||
cancellationToken.ThrowIfCancellationRequested ();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int TryAddToAny (BlockingCollection<T>[] collections, T item)
|
||||
@@ -368,21 +366,7 @@ namespace System.Collections.Concurrent
|
||||
|
||||
public static int TakeFromAny (BlockingCollection<T>[] collections, out T item)
|
||||
{
|
||||
item = default (T);
|
||||
CheckArray (collections);
|
||||
WaitHandle[] wait_table = null;
|
||||
while (true) {
|
||||
for (int i = 0; i < collections.Length; ++i) {
|
||||
if (collections [i].TryTake (out item))
|
||||
return i;
|
||||
}
|
||||
if (wait_table == null) {
|
||||
wait_table = new WaitHandle [collections.Length];
|
||||
for (int i = 0; i < collections.Length; ++i)
|
||||
wait_table [i] = collections [i].mreRemove.WaitHandle;
|
||||
}
|
||||
WaitHandle.WaitAny (wait_table);
|
||||
}
|
||||
return TakeFromAny (collections, out item, CancellationToken.None);
|
||||
}
|
||||
|
||||
public static int TakeFromAny (BlockingCollection<T>[] collections, out T item, CancellationToken cancellationToken)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
@@ -227,7 +227,7 @@ namespace System.Diagnostics
|
||||
DateFormat, CultureInfo.InvariantCulture);
|
||||
DateTime timeWritten = File.GetLastWriteTime (file);
|
||||
int stringNums = int.Parse (tr.ReadLine ().Substring (20));
|
||||
ArrayList replacementTemp = new ArrayList ();
|
||||
var replacementTemp = new List<string> ();
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
while (replacementTemp.Count < stringNums) {
|
||||
char c = (char) tr.Read ();
|
||||
@@ -238,8 +238,7 @@ namespace System.Diagnostics
|
||||
sb.Append (c);
|
||||
}
|
||||
}
|
||||
string [] replacementStrings = new string [replacementTemp.Count];
|
||||
replacementTemp.CopyTo (replacementStrings, 0);
|
||||
string [] replacementStrings = replacementTemp.ToArray ();
|
||||
|
||||
string message = FormatMessage (source, instanceID, replacementStrings);
|
||||
int eventID = EventLog.GetEventID (instanceID);
|
||||
|
||||
@@ -39,7 +39,7 @@ using System.ComponentModel.Design;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
|
||||
@@ -832,13 +832,13 @@ namespace System.Diagnostics {
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private extern static int[] GetProcesses_internal();
|
||||
|
||||
public static Process[] GetProcesses()
|
||||
public static Process[] GetProcesses ()
|
||||
{
|
||||
int [] pids = GetProcesses_internal ();
|
||||
if (pids == null)
|
||||
return new Process [0];
|
||||
|
||||
ArrayList proclist = new ArrayList (pids.Length);
|
||||
var proclist = new List<Process> (pids.Length);
|
||||
for (int i = 0; i < pids.Length; i++) {
|
||||
try {
|
||||
proclist.Add (GetProcessById (pids [i]));
|
||||
@@ -851,7 +851,7 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
return ((Process []) proclist.ToArray (typeof (Process)));
|
||||
return proclist.ToArray ();
|
||||
}
|
||||
|
||||
[MonoTODO ("There is no support for retrieving process information from a remote machine")]
|
||||
@@ -871,7 +871,7 @@ namespace System.Diagnostics {
|
||||
if (pids == null)
|
||||
return new Process [0];
|
||||
|
||||
ArrayList proclist = new ArrayList (pids.Length);
|
||||
var proclist = new List<Process> (pids.Length);
|
||||
for (int i = 0; i < pids.Length; i++) {
|
||||
try {
|
||||
Process p = GetProcessById (pids [i]);
|
||||
@@ -886,7 +886,7 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
return ((Process []) proclist.ToArray (typeof (Process)));
|
||||
return proclist.ToArray ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
@@ -940,7 +940,7 @@ namespace System.Diagnostics {
|
||||
ref proc_info);
|
||||
} finally {
|
||||
if (proc_info.Password != IntPtr.Zero)
|
||||
Marshal.FreeBSTR (proc_info.Password);
|
||||
Marshal.ZeroFreeBSTR (proc_info.Password);
|
||||
proc_info.Password = IntPtr.Zero;
|
||||
}
|
||||
if (!ret) {
|
||||
@@ -1080,7 +1080,7 @@ namespace System.Diagnostics {
|
||||
ref proc_info);
|
||||
} finally {
|
||||
if (proc_info.Password != IntPtr.Zero)
|
||||
Marshal.FreeBSTR (proc_info.Password);
|
||||
Marshal.ZeroFreeBSTR (proc_info.Password);
|
||||
proc_info.Password = IntPtr.Zero;
|
||||
}
|
||||
if (!ret) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
@@ -177,12 +177,11 @@ namespace System.Diagnostics
|
||||
|
||||
string [] sources = (string []) logKey.GetValue ("Sources");
|
||||
if (sources != null) {
|
||||
ArrayList temp = new ArrayList ();
|
||||
var temp = new List<string> ();
|
||||
for (int i = 0; i < sources.Length; i++)
|
||||
if (sources [i] != source)
|
||||
temp.Add (sources [i]);
|
||||
string [] newSources = new string [temp.Count];
|
||||
temp.CopyTo (newSources, 0);
|
||||
string [] newSources = temp.ToArray ();
|
||||
logKey.SetValue ("Sources", newSources);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ namespace System.IO.Ports
|
||||
// Probe for Linux-styled devices: /dev/ttyS* or /dev/ttyUSB*
|
||||
//
|
||||
foreach (string dev in ttys) {
|
||||
if (dev.StartsWith("/dev/ttyS") || dev.StartsWith("/dev/ttyUSB")){
|
||||
if (dev.StartsWith("/dev/ttyS") || dev.StartsWith("/dev/ttyUSB") || dev.StartsWith("/dev/ttyACM")) {
|
||||
linux_style = true;
|
||||
break;
|
||||
}
|
||||
@@ -537,7 +537,7 @@ namespace System.IO.Ports
|
||||
|
||||
foreach (string dev in ttys) {
|
||||
if (linux_style){
|
||||
if (dev.StartsWith("/dev/ttyS") || dev.StartsWith("/dev/ttyUSB"))
|
||||
if (dev.StartsWith("/dev/ttyS") || dev.StartsWith("/dev/ttyUSB") || dev.StartsWith("/dev/ttyACM"))
|
||||
serial_ports.Add (dev);
|
||||
} else {
|
||||
if (dev != "/dev/tty" && dev.StartsWith ("/dev/tty") && !dev.StartsWith ("/dev/ttyC"))
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
@@ -240,12 +241,12 @@ namespace System.IO {
|
||||
return;
|
||||
|
||||
/* Removed files */
|
||||
ArrayList removed = null;
|
||||
List<string> removed = null;
|
||||
foreach (string filename in data.Files.Keys) {
|
||||
FileData fd = (FileData) data.Files [filename];
|
||||
if (fd.NotExists) {
|
||||
if (removed == null)
|
||||
removed = new ArrayList ();
|
||||
removed = new List<string> ();
|
||||
|
||||
removed.Add (filename);
|
||||
DispatchEvents (data.FSW, FileAction.Removed, filename);
|
||||
@@ -269,7 +270,7 @@ namespace System.IO {
|
||||
} catch {
|
||||
/* Deleted */
|
||||
if (removed == null)
|
||||
removed = new ArrayList ();
|
||||
removed = new List<string> ();
|
||||
|
||||
removed.Add (filename);
|
||||
DispatchEvents (data.FSW, FileAction.Removed, filename);
|
||||
|
||||
@@ -183,7 +183,10 @@ namespace System.IO {
|
||||
internal SearchPattern2 Pattern {
|
||||
get {
|
||||
if (pattern == null) {
|
||||
pattern = new SearchPattern2 (MangledFilter);
|
||||
if (watcher.GetType () == typeof (KeventWatcher))
|
||||
pattern = new SearchPattern2 (MangledFilter, true); //assume we want to ignore case (OS X)
|
||||
else
|
||||
pattern = new SearchPattern2 (MangledFilter);
|
||||
}
|
||||
return pattern;
|
||||
}
|
||||
@@ -372,52 +375,60 @@ namespace System.IO {
|
||||
ErrorEvent,
|
||||
RenameEvent
|
||||
}
|
||||
private void RaiseEvent (Delegate ev, EventArgs arg, EventType evtype)
|
||||
{
|
||||
if (ev == null)
|
||||
return;
|
||||
|
||||
if (synchronizingObject == null) {
|
||||
switch (evtype) {
|
||||
case EventType.RenameEvent:
|
||||
((RenamedEventHandler)ev).BeginInvoke (this, (RenamedEventArgs) arg, null, null);
|
||||
break;
|
||||
case EventType.ErrorEvent:
|
||||
((ErrorEventHandler)ev).BeginInvoke (this, (ErrorEventArgs) arg, null, null);
|
||||
break;
|
||||
case EventType.FileSystemEvent:
|
||||
((FileSystemEventHandler)ev).BeginInvoke (this, (FileSystemEventArgs) arg, null, null);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
synchronizingObject.BeginInvoke (ev, new object [] {this, arg});
|
||||
}
|
||||
|
||||
protected void OnChanged (FileSystemEventArgs e)
|
||||
{
|
||||
RaiseEvent (Changed, e, EventType.FileSystemEvent);
|
||||
if (Changed == null)
|
||||
return;
|
||||
|
||||
if (synchronizingObject == null)
|
||||
Changed (this, e);
|
||||
else
|
||||
synchronizingObject.BeginInvoke (Changed, new object[] { this, e });
|
||||
}
|
||||
|
||||
protected void OnCreated (FileSystemEventArgs e)
|
||||
{
|
||||
RaiseEvent (Created, e, EventType.FileSystemEvent);
|
||||
if (Created == null)
|
||||
return;
|
||||
|
||||
if (synchronizingObject == null)
|
||||
Created (this, e);
|
||||
else
|
||||
synchronizingObject.BeginInvoke (Created, new object[] { this, e });
|
||||
}
|
||||
|
||||
protected void OnDeleted (FileSystemEventArgs e)
|
||||
{
|
||||
RaiseEvent (Deleted, e, EventType.FileSystemEvent);
|
||||
if (Deleted == null)
|
||||
return;
|
||||
|
||||
if (synchronizingObject == null)
|
||||
Deleted (this, e);
|
||||
else
|
||||
synchronizingObject.BeginInvoke (Deleted, new object[] { this, e });
|
||||
}
|
||||
|
||||
protected void OnError (ErrorEventArgs e)
|
||||
internal void OnError (ErrorEventArgs e)
|
||||
{
|
||||
RaiseEvent (Error, e, EventType.ErrorEvent);
|
||||
if (Error == null)
|
||||
return;
|
||||
|
||||
if (synchronizingObject == null)
|
||||
Error (this, e);
|
||||
else
|
||||
synchronizingObject.BeginInvoke (Error, new object[] { this, e });
|
||||
}
|
||||
|
||||
protected void OnRenamed (RenamedEventArgs e)
|
||||
{
|
||||
RaiseEvent (Renamed, e, EventType.RenameEvent);
|
||||
if (Renamed == null)
|
||||
return;
|
||||
|
||||
if (synchronizingObject == null)
|
||||
Renamed (this, e);
|
||||
else
|
||||
synchronizingObject.BeginInvoke (Renamed, new object[] { this, e });
|
||||
}
|
||||
|
||||
public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType)
|
||||
|
||||
Loaded 100 of 393 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user