mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-15 17:10:51 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27589b59b9 | ||
|
|
8f4c7c9e1a | ||
|
|
950b5dc41b | ||
|
|
5901f1de17 | ||
|
|
84c1469a25 | ||
|
|
e08028625d | ||
|
|
acbaa50498 | ||
|
|
b92652fb0c | ||
|
|
b400a612a4 | ||
|
|
f75dddbe61 | ||
|
|
ce5c0e651e | ||
|
|
11cd4f09ed | ||
|
|
15c1fae0ea | ||
|
|
b712e0ae63 | ||
|
|
7304ee6ef0 | ||
|
|
ef23c9aaeb | ||
|
|
5eecf6b197 | ||
|
|
74dcf0f4e7 | ||
|
|
2a21dbb533 | ||
|
|
fdf4913561 | ||
|
|
a1ea9b3ab8 | ||
|
|
d22d581784 | ||
|
|
7ff68d17a2 | ||
|
|
ebbca31e3c | ||
|
|
fbe5f68924 | ||
|
|
aca813ba8d | ||
|
|
d4955be897 | ||
|
|
84ada866ad | ||
|
|
d7e563dd87 | ||
|
|
2085fa219c | ||
|
|
8d34f01dfc | ||
|
|
ac1aa9d309 | ||
|
|
97434a0a9b | ||
|
|
1c03c661b4 | ||
|
|
7e204d02b5 | ||
|
|
34d0ee8c95 | ||
|
|
05442e11d7 | ||
|
|
42f06c7663 | ||
|
|
8c002790f7 | ||
|
|
7172bcccf8 | ||
|
|
4ff65f3ac1 | ||
|
|
de4d2ec78b | ||
|
|
6e6489d471 | ||
|
|
986524c0bb | ||
|
|
ffe099d2fc | ||
|
|
a317249bec | ||
|
|
fc98dcc51c | ||
|
|
48ee1b70a0 | ||
|
|
ab154c2bdb | ||
|
|
e2bde717f8 | ||
|
|
e34e7f2de8 | ||
|
|
1e30039a0a | ||
|
|
4881df3014 | ||
|
|
38af1d1400 | ||
|
|
6a50c9ec35 | ||
|
|
5e0f8cda9a | ||
|
|
a094e9a735 | ||
|
|
816e0e8fdd | ||
|
|
47e1dbf970 | ||
|
|
aa19449ebb | ||
|
|
90041dc378 | ||
|
|
922912292b | ||
|
|
c92fff7043 | ||
|
|
e3931f38b6 | ||
|
|
493e003258 | ||
|
|
32bf6cac04 | ||
|
|
0c8aa2ee8b | ||
|
|
0ee8a2414d | ||
|
|
eb08b06215 | ||
|
|
88b7acff98 | ||
|
|
84fd92865b | ||
|
|
400afe1a8f | ||
|
|
d9755b89e6 | ||
|
|
8c8593fd96 | ||
|
|
200118c485 | ||
|
|
8575b3983a | ||
|
|
d99e8f21af | ||
|
|
df53237ac6 | ||
|
|
24ad061817 | ||
|
|
76ffb82a48 | ||
|
|
53cc1f8d6d | ||
|
|
0489b56686 | ||
|
|
4f856e94a3 | ||
|
|
a927203608 | ||
|
|
4313c50b3d | ||
|
|
09a2a27d27 | ||
|
|
c6c5c7c8b6 | ||
|
|
8a19ec3273 | ||
|
|
32d603eda4 | ||
|
|
11b4aef454 | ||
|
|
b1b4f52b34 | ||
|
|
bff28446a2 | ||
|
|
08df38ca1b | ||
|
|
21eef2e77e | ||
|
|
cff463913d | ||
|
|
e040c39674 | ||
|
|
eeca83c94d | ||
|
|
1a66d85f3b | ||
|
|
8508387f81 | ||
|
|
cd41807bcb | ||
|
|
fff850ae00 | ||
|
|
c4af40f5cf | ||
|
|
ace3196c2b | ||
|
|
890a4f46f5 | ||
|
|
fd89397e70 | ||
|
|
50c7e593cb | ||
|
|
c06c09bd60 | ||
|
|
4a3bf3d995 | ||
|
|
f59cfce9df | ||
|
|
b73876a464 | ||
|
|
836e73df60 | ||
|
|
c524bc933b | ||
|
|
9d136bfc7c | ||
|
|
ac220e9c0e | ||
|
|
ee8370eb8d | ||
|
|
bdffeb6712 | ||
|
|
eb24cb0d59 | ||
|
|
034798235b | ||
|
|
f049ca86f7 | ||
|
|
bcd05ee327 | ||
|
|
4ed001307d | ||
|
|
4b4f5466cd | ||
|
|
914d38a33e | ||
|
|
8e677f9921 | ||
|
|
12815c0c7e | ||
|
|
b535b7d4c0 | ||
|
|
3f1a1dbdfe | ||
|
|
eceec54500 | ||
|
|
c3335e6f62 | ||
|
|
d8feb83640 | ||
|
|
3a520d36c4 | ||
|
|
3fe2bf4538 | ||
|
|
00f2704267 | ||
|
|
150b04b1b9 | ||
|
|
098fc0b907 | ||
|
|
1b5cea04fc | ||
|
|
e61b2cd43d | ||
|
|
69b329a4a5 | ||
|
|
8cc06e5e77 | ||
|
|
4fd91bf1c0 | ||
|
|
6b9376a9bf | ||
|
|
c457bcfa42 | ||
|
|
63d82ffc3c | ||
|
|
2bdd7e92d3 | ||
|
|
5bb5d1d407 | ||
|
|
ca426640a8 | ||
|
|
718382bad7 | ||
|
|
32bf4798e3 | ||
|
|
dcff2f2285 | ||
|
|
17c171a0f9 | ||
|
|
2debaf6612 | ||
|
|
42d8948ea3 | ||
|
|
6b01c59030 | ||
|
|
00acd5fd49 | ||
|
|
f434ba459c | ||
|
|
34c5d71769 | ||
|
|
53acf05e01 | ||
|
|
be859b75ff | ||
|
|
f958258d28 | ||
|
|
a5d0787137 | ||
|
|
fc990b1fdc | ||
|
|
f97835553c | ||
|
|
9dd4b35d13 | ||
|
|
5a440ac217 | ||
|
|
67cbfb1f5c | ||
|
|
90a94a6b8b | ||
|
|
f6479e150f | ||
|
|
1208b12f69 | ||
|
|
d3d80927e1 | ||
|
|
73146ea69a | ||
|
|
f7d427a360 | ||
|
|
2b8f2bd2eb | ||
|
|
11d0202305 | ||
|
|
a755dfc8ab | ||
|
|
2c9a79735d | ||
|
|
abc43192bf | ||
|
|
791e158847 | ||
|
|
35022b4629 | ||
|
|
13e7da0b12 | ||
|
|
31d1906af8 | ||
|
|
e8030a1270 | ||
|
|
81732363f2 | ||
|
|
e47086ae2c | ||
|
|
adb5812097 | ||
|
|
a629d14e14 | ||
|
|
455afec78e | ||
|
|
cee2f48565 | ||
|
|
3a1003365a | ||
|
|
d8f224fa77 | ||
|
|
22492c37cc | ||
|
|
a9e7fb0abd | ||
|
|
02284d8008 | ||
|
|
0b4c366520 | ||
|
|
f5c7491d79 | ||
|
|
4dd31c484d | ||
|
|
48c4359548 | ||
|
|
3d48548a24 | ||
|
|
bfb47f0422 | ||
|
|
c5e9df9a7d | ||
|
|
4bfa3b8cb4 | ||
|
|
d0cfd383a1 | ||
|
|
236f5b982c | ||
|
|
082abf401a | ||
|
|
bc2585699c | ||
|
|
6dad7702ea | ||
|
|
84031f8584 | ||
|
|
243a027520 | ||
|
|
5b78093eef | ||
|
|
4b6d5edc78 | ||
|
|
b9d3e3262c | ||
|
|
77c4302bdf | ||
|
|
7f13ce00ce | ||
|
|
643a83b9a0 | ||
|
|
25b50b1c80 | ||
|
|
2e3f003f5f | ||
|
|
b8a1e12c73 | ||
|
|
95ca868476 | ||
|
|
58c2baf6a6 | ||
|
|
3fc405788c | ||
|
|
79d7ad5921 | ||
|
|
4809f77419 | ||
|
|
71b8786ee9 | ||
|
|
0c0fa5ec89 | ||
|
|
57e29afeaf | ||
|
|
c1577730af | ||
|
|
e22310c6b8 | ||
|
|
dc34921ff7 | ||
|
|
c4c2071766 | ||
|
|
16e7814ee4 | ||
|
|
568d44fd06 | ||
|
|
bcdc624995 | ||
|
|
f2b360fc5d | ||
|
|
f913aabf5c | ||
|
|
3cd16ddbdb | ||
|
|
8edff05440 | ||
|
|
bd3a3e1ec5 | ||
|
|
330dee9522 | ||
|
|
e65b5f396b | ||
|
|
5c4721c3d5 | ||
|
|
3f7fdcc82d | ||
|
|
a3d384dbbf | ||
|
|
699f408478 | ||
|
|
332943e496 | ||
|
|
204dc4ea04 | ||
|
|
49bbf1f4c3 | ||
|
|
401cabfc6a | ||
|
|
a2e8d38fa6 | ||
|
|
099b6e3c26 | ||
|
|
9979ab1f91 | ||
|
|
f11abca644 | ||
|
|
c12233306a | ||
|
|
5995136419 | ||
|
|
2441d1f521 | ||
|
|
410a27b2bf | ||
|
|
a05f9f8b5e | ||
|
|
6e5c11cd30 | ||
|
|
b1c0dfa135 | ||
|
|
3653a83b39 | ||
|
|
cb0c6ba813 | ||
|
|
16eaf2a641 | ||
|
|
516a0835f0 | ||
|
|
7ff67aa81a | ||
|
|
6f0d5440ce | ||
|
|
06c1a5f74c | ||
|
|
572fa90350 | ||
|
|
9a7ac8152c | ||
|
|
9468c9429f | ||
|
|
0c702ece52 | ||
|
|
8b2e70be67 | ||
|
|
8ee63bd04a | ||
|
|
30f6ae193f | ||
|
|
6d52bd6446 | ||
|
|
85b4874919 | ||
|
|
ab52d70383 | ||
|
|
64d093c92a | ||
|
|
b0af86bfc2 | ||
|
|
655579cbb1 | ||
|
|
2809fe1936 | ||
|
|
e5590d4ff5 | ||
|
|
4d259921aa | ||
|
|
0043b1fd2b | ||
|
|
8b50ed4dbb | ||
|
|
7727921d34 | ||
|
|
56c1d33ae4 | ||
|
|
cad348bcb2 | ||
|
|
c643703e79 | ||
|
|
9c234e78b1 | ||
|
|
85c63ecffe | ||
|
|
86877ecd25 | ||
|
|
a228d05aec | ||
|
|
19503869ca | ||
|
|
9e91c826fd | ||
|
|
ebb82987f6 | ||
|
|
e311191ef7 | ||
|
|
ab819e4118 | ||
|
|
dc3f9d3f6d | ||
|
|
451bc2a8a8 | ||
|
|
84b2d6bfec | ||
|
|
a498cddad7 | ||
|
|
03c6b6918b | ||
|
|
dc279e74dc |
No files matched your search
@@ -1,3 +1,14 @@
|
||||
2009-02-26 Marek Habersack <[email protected]>
|
||||
|
||||
* data/mono.web.pc.in: added. Fixes bug #479760
|
||||
|
||||
* data/Makefile.am: added mono.pc{.in} wherever necessary
|
||||
|
||||
2009-02-07 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* configure.in: include stdio so that NULL is defined when checking
|
||||
for ifreq.
|
||||
|
||||
2009-01-17 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Complete the OPROFILE checks.
|
||||
|
||||
+3
-1
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
|
||||
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(mono,2.3)
|
||||
AM_INIT_AUTOMAKE(mono,2.4)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
API_VER=1.0
|
||||
@@ -1361,6 +1361,7 @@ if test x$platform_win32 = xno; then
|
||||
AC_CHECK_HEADERS(net/if.h)
|
||||
AC_MSG_CHECKING(for ifreq)
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
], [
|
||||
@@ -2367,6 +2368,7 @@ data/mono-nunit.pc
|
||||
data/mono-options.pc
|
||||
data/mono-lineeditor.pc
|
||||
data/monodoc.pc
|
||||
data/mono.web.pc
|
||||
data/dotnet.pc
|
||||
data/dotnet35.pc
|
||||
data/wcf.pc
|
||||
|
||||
+4
-4
@@ -8,24 +8,24 @@ EXTRA_DIST = \
|
||||
mono.pc.in mint.pc.in dotnet.pc.in dotnet35.pc.in wcf.pc.in monodoc.pc.in \
|
||||
mono-nunit.pc.in mono-cairo.pc.in mono-options.pc.in cecil.pc.in smcs.pc.in \
|
||||
mono-lineeditor.pc.in system.web.extensions_1.0.pc.in system.web.extensions.design_1.0.pc.in\
|
||||
dtrace-prelink.sh
|
||||
dtrace-prelink.sh mono.web.pc.in
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
|
||||
if JIT_SUPPORTED
|
||||
if INTERP_SUPPORTED
|
||||
pkgconfig_DATA= mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc
|
||||
system.web.extensions.design_1.0.pc mono.web.pc
|
||||
else
|
||||
pkgconfig_DATA= mono.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc
|
||||
system.web.extensions.design_1.0.pc mono.web.pc
|
||||
endif
|
||||
else
|
||||
pkgconfig_DATA= mint.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc
|
||||
endif
|
||||
|
||||
DISTCLEANFILES= mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc
|
||||
system.web.extensions.design_1.0.pc mono.web.pc
|
||||
|
||||
mono_DATA = config \
|
||||
browscap.ini
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
Name: Mono.Web
|
||||
Description: Mono ASP.NET extension classes
|
||||
Version: 2.0.0.0
|
||||
Libs: -r:@prefix@/lib/mono/gac/Mono.Web/2.0.0.0__0738eb9f132ed756/Mono.Web.dll
|
||||
@@ -1,3 +1,11 @@
|
||||
2009-02-24 Jonathan Pryor <[email protected]>
|
||||
|
||||
* docs/Makefile: Remove and don't install nunit-docs.source. As
|
||||
Atsushi Enomoto said on 2008-11-26, Mono's NUnit is for internal use
|
||||
only, and installing nunit-docs.source causes an warning message
|
||||
during monodoc startup.
|
||||
* docs/nunit-docs.source: Remove.
|
||||
|
||||
2008-12-10 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Makefile : remove sys.messaging from CENTUM_TESTS. It has never
|
||||
|
||||
@@ -1,3 +1,207 @@
|
||||
2009-02-24 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridViewCell.cs: Invalidate the datagrid when the cell is selected
|
||||
or deselected.
|
||||
[Fixes bug #479124]
|
||||
|
||||
2009-02-23 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Make the ScrollBars property work properly.
|
||||
|
||||
2009-02-22 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Fix row removal in the data-bound scenario.
|
||||
|
||||
2009-02-19 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridViewCell.cs: Use strict equality comparison in order to
|
||||
prevent superfluous CellValueChanged events.
|
||||
|
||||
2009-02-19 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Do not reset the columns when the data list changes,
|
||||
but only the rows. Fixes multiple bugs related to sorting, custom
|
||||
column styles being reset and more.
|
||||
|
||||
2009-02-07 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: End or if end fails then cancel the current edit
|
||||
operation before clearing the data source.
|
||||
|
||||
2009-02-07 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Data-bind only after the handle is created.
|
||||
[Fixes bug #473680]
|
||||
|
||||
2009-02-05 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridViewRowCollection.cs, DataGridView.cs: Fix row insertation:
|
||||
- Use ArrayList.Insert instead of the Item property so that the item
|
||||
is actually inserted and not an existing item replaced.
|
||||
- Call DataGridView.OnRowsAddedInternal and drop internal from
|
||||
OnRowsAdded for binary compitability. This also fixes several
|
||||
redrawing issues.
|
||||
[Fixes bug #472968]
|
||||
|
||||
2009-02-05 Andrés G. Aragoneses <[email protected]>
|
||||
|
||||
* ToolBarButton.cs: OnTextChanged added.
|
||||
(Backport of r125802.) r: jpobst
|
||||
|
||||
2009-02-03 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridViewRowCollection.cs, DataGridView.cs: Move row completion
|
||||
code in the row collection code, so that the completion happens before
|
||||
the CollectionChanged event, also better encapsulation.
|
||||
[Fixes bug #471987]
|
||||
|
||||
2009-02-02 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: When editing is finished do not remove the editing
|
||||
row, because it has already become a real one. Instead add a new one.
|
||||
[Fixes bug #471754]
|
||||
|
||||
2009-02-02 Andrés G. Aragoneses <[email protected]>
|
||||
|
||||
* ToolBar.cs: Add new UIAPerformClick method to be called by
|
||||
UIAutomationWinforms when someone calls Invoke() on the
|
||||
ToolBarButtonProvider. (Backport of r125354.) r: jpobst
|
||||
|
||||
2009-02-01 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Complete incomplete rows when they are added to
|
||||
the grid.
|
||||
[Fixes bug #471068]
|
||||
|
||||
2009-02-01 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs, DataGridViewColumnCollection.cs: Ensure that the
|
||||
binding is cleared prior to setting it to null. Fixes a regression
|
||||
causing exceptions when the DataSource is set to null and then set
|
||||
again to a data source.
|
||||
|
||||
2009-02-01 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs, DataGridViewImageColumn.cs, DataGridViewCell.cs:
|
||||
- Make Image/Bitmap cells work.
|
||||
- Handle images with size greater than the cell.
|
||||
- Default to MiddleCenter alignment for image cells.
|
||||
[Fixes bug #471101]
|
||||
|
||||
2009-01-29 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* XplatUIX11.cs: We should use utf8 handling clipboard transference
|
||||
with other x11 applications, and use utf16 when handling clipboard
|
||||
data in the class library. Update the related points as well.
|
||||
Fixes #468683.
|
||||
|
||||
2009-01-28 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridViewCell.cs: Format strings according to the supplied
|
||||
CellStyle.Format.
|
||||
[Fixes bug #470384]
|
||||
|
||||
2009-01-28 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Reset the hover cell if it gets moved due to row(s)
|
||||
addition or removal. Fixes multiple crashes in OnMouseMove.
|
||||
|
||||
2009-01-28 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeNode.cs: NextVisibleNode and PrevVisibleNode properties don't
|
||||
take into account the fact that OpenTreeNodeEnumerator needs to call
|
||||
MoveNext/MovePrevious to actually put the passed node as the one
|
||||
retrieved in Current. This way this property should work as really
|
||||
expected in .net.
|
||||
Fixes part of #467225.
|
||||
|
||||
2009-01-28 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: When calculating the scrollbars, don't use
|
||||
TreeNode.Bounds, since it still can have the values of the previous
|
||||
-and now invalid- layout -which depends on TreeView.skipped_nodes, and
|
||||
could not have been updated as well-, and use the actual number of
|
||||
visible number of nodes to compute the height needed to contain all
|
||||
the nodes. Also reset the value of vbar to 0 when disabled - this way
|
||||
we make sure that, when re-enabled, it will update the visible area of
|
||||
the treeview, even if the previous value before disabling it is the
|
||||
same as now. Finally don't do anything for the vbar.ValueChanged
|
||||
handler - for the case wheer we manually set the value but don't the
|
||||
vbar is disabled already.
|
||||
Fixes part of #467225.
|
||||
|
||||
2009-01-28 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: In CollapseAll, set vbar to the maximum value, instead
|
||||
of trying to set as top node the highest parent of the previous
|
||||
top node. Moving to the bottom of the TreeView after a call
|
||||
to CollapseAll is exactly what .net does. This should avoid some
|
||||
nasty issue when CollapseAll is called and we don't need the
|
||||
vertical scroll bar.
|
||||
|
||||
2009-01-27 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Fix a NRE when setting the CurrentCell to null.
|
||||
|
||||
2009-01-27 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* XplatUIX11.cs: Fire Timer.Tick even if there is no MainForm for the
|
||||
current context.
|
||||
[Fixes bug #469239]
|
||||
|
||||
2009-01-26 Andreia Gaita <[email protected]>
|
||||
|
||||
* WebBrowser.cs: fix initial value of ScrollbarsEnabled, so they
|
||||
won't be disabled by default.
|
||||
Fixes #468690
|
||||
|
||||
2009-01-26 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Do not clear the rows if we are not databound.
|
||||
|
||||
2009-01-26 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Do not be too smart about selecting the first cell
|
||||
when the first row is added as this is not what MS does. Fixes the
|
||||
failing unit tests.
|
||||
|
||||
2009-01-23 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs, DataGridViewCell.cs: Fix crashes when there is no
|
||||
editing control.
|
||||
|
||||
2009-01-23 Ivan N. Zlatev <[email protected]>
|
||||
|
||||
* DataGridView.cs: Fix new row adding/editing in the non-databound
|
||||
scenario.
|
||||
|
||||
2009-01-21 Neville Gao <[email protected]>
|
||||
|
||||
* ToolBar.cs: Backported r124045: Control enabled to support
|
||||
accessibility. Added UIACollectionChangedEvent.
|
||||
[Fixes Bug #455950]
|
||||
|
||||
2009-01-21 Mike Gorse <[email protected]>
|
||||
|
||||
* TrackBar.cs: Backported R124116: Make LargeIncrement/Decrement
|
||||
internal so that UIA can use them.
|
||||
Added UIAValueParamChangedEvent.
|
||||
|
||||
2009-01-21 Mario Carrion <[email protected]>
|
||||
|
||||
* Form.cs: Backported r124064: UIA Support: Internal events
|
||||
added: UIAWindowStateChanged and UIATopMostChanged.
|
||||
|
||||
2009-01-21 Sandy Armstrong <[email protected]>
|
||||
|
||||
* MenuItem.cs: Add UIACheckChanged, UIARadioCheckChanged,
|
||||
UIAEnabledChanged, and UIATextChanged events.
|
||||
|
||||
* Form.cs: Add UIAMenuChanged event.
|
||||
|
||||
* Menu.cs:
|
||||
* MenuAPI.cs: Note which internal APIs are being used by UIA.
|
||||
|
||||
2009-01-19 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* TreeView.cs: When handling mouse up event, check whether
|
||||
|
||||
@@ -215,6 +215,7 @@ namespace System.Windows.Forms {
|
||||
selectionMode = DataGridViewSelectionMode.RowHeaderSelect;
|
||||
showCellErrors = true;
|
||||
showEditingIcon = true;
|
||||
scrollBars = ScrollBars.Both;
|
||||
userSetCursor = Cursor.Current;
|
||||
virtualMode = false;
|
||||
|
||||
@@ -680,13 +681,12 @@ namespace System.Windows.Forms {
|
||||
/// to the data cache, or the new cell is in a hidden
|
||||
/// row.
|
||||
/////////////////////////////////////////////////////
|
||||
if (value.DataGridView != this)
|
||||
throw new ArgumentException("The cell is not in this DataGridView.");
|
||||
|
||||
if (value != null)
|
||||
MoveCurrentCell (value.OwningColumn.Index, value.OwningRow.Index, true, false, false, true);
|
||||
else
|
||||
if (value == null)
|
||||
MoveCurrentCell (-1, -1, true, false, false, true);
|
||||
else if (value.DataGridView != this)
|
||||
throw new ArgumentException("The cell is not in this DataGridView.");
|
||||
else
|
||||
MoveCurrentCell (value.OwningColumn.Index, value.OwningRow.Index, true, false, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,7 +711,8 @@ namespace System.Windows.Forms {
|
||||
set {
|
||||
if (dataMember != value) {
|
||||
dataMember = value;
|
||||
ReBind ();
|
||||
if (IsHandleCreated)
|
||||
ReBind ();
|
||||
OnDataMemberChanged(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
@@ -732,8 +733,10 @@ namespace System.Windows.Forms {
|
||||
if (!(value == null || value is IList || value is IListSource || value is IBindingList || value is IBindingListView))
|
||||
throw new NotSupportedException ("Type cannot be bound.");
|
||||
|
||||
ClearBinding ();
|
||||
dataSource = value;
|
||||
ReBind ();
|
||||
if (IsHandleCreated)
|
||||
ReBind ();
|
||||
OnDataSourceChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
@@ -1166,6 +1169,8 @@ namespace System.Windows.Forms {
|
||||
/// or canceled.
|
||||
///////////////////////////////////////////////////////////
|
||||
scrollBars = value;
|
||||
PerformLayout ();
|
||||
Invalidate ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2295,7 +2300,8 @@ namespace System.Windows.Forms {
|
||||
cell.PositionEditingControl (true, true, this.GetCellDisplayRectangle (cell.ColumnIndex, cell.RowIndex, false), bounds, style, false, false, (columns [cell.ColumnIndex].DisplayIndex == 0), (cell.RowIndex == 0));
|
||||
|
||||
// Show the editing control
|
||||
EditingControlInternal.Visible = true;
|
||||
if (EditingControlInternal != null)
|
||||
EditingControlInternal.Visible = true;
|
||||
|
||||
IDataGridViewEditingControl dgvEditingControl = (IDataGridViewEditingControl) EditingControlInternal;
|
||||
if (dgvEditingControl != null) {
|
||||
@@ -2328,7 +2334,8 @@ namespace System.Windows.Forms {
|
||||
DataManager.CancelCurrentEdit ();
|
||||
|
||||
new_row_editing = false;
|
||||
PrepareEditingRow (true, false);
|
||||
PrepareEditingRow (false, false);
|
||||
MoveCurrentCell (currentCell.ColumnIndex, NewRowIndex, true, false, false, true);
|
||||
OnUserDeletedRow (new DataGridViewRowEventArgs (EditingRow));
|
||||
}
|
||||
}
|
||||
@@ -2427,7 +2434,9 @@ namespace System.Windows.Forms {
|
||||
Focus ();
|
||||
if (currentCell.RowIndex == NewRowIndex) {
|
||||
new_row_editing = false;
|
||||
PrepareEditingRow (false, false);
|
||||
editing_row = null; // editing row becomes a real row
|
||||
PrepareEditingRow (true, false); // add a new editing row
|
||||
MoveCurrentCell (currentCell.ColumnIndex, NewRowIndex, true, false, false, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -3662,7 +3671,6 @@ namespace System.Windows.Forms {
|
||||
//
|
||||
if (!is_autogenerating_columns && columns.Count == 1)
|
||||
ReBind ();
|
||||
|
||||
foreach (DataGridViewRow row in Rows)
|
||||
row.Cells.Add ((DataGridViewCell)e.Column.CellTemplate.Clone ());
|
||||
}
|
||||
@@ -3963,6 +3971,7 @@ namespace System.Windows.Forms {
|
||||
protected override void OnHandleCreated (EventArgs e)
|
||||
{
|
||||
base.OnHandleCreated(e);
|
||||
ReBind ();
|
||||
|
||||
if (CurrentCell == null && Rows.Count > 0 && Columns.Count > 0)
|
||||
MoveCurrentCell (ColumnDisplayIndexToIndex (0), 0, true, false, false, false);
|
||||
@@ -4609,23 +4618,25 @@ namespace System.Windows.Forms {
|
||||
bool verticalVisible = false;
|
||||
|
||||
if (AutoSize) {
|
||||
if (gridWidth > Size.Width || gridHeight > Size.Height) {
|
||||
if (gridWidth > Size.Width || gridHeight > Size.Height)
|
||||
Size = new Size(gridWidth, gridHeight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (gridWidth > Size.Width) {
|
||||
if (gridWidth > Size.Width)
|
||||
horizontalVisible = true;
|
||||
}
|
||||
if (gridHeight > Size.Height) {
|
||||
if (gridHeight > Size.Height)
|
||||
verticalVisible = true;
|
||||
}
|
||||
if (horizontalScrollBar.Visible && (gridHeight + horizontalScrollBar.Height) > Size.Height) {
|
||||
|
||||
if (horizontalScrollBar.Visible && (gridHeight + horizontalScrollBar.Height) > Size.Height)
|
||||
verticalVisible = true;
|
||||
}
|
||||
if (verticalScrollBar.Visible && (gridWidth + verticalScrollBar.Width) > Size.Width) {
|
||||
if (verticalScrollBar.Visible && (gridWidth + verticalScrollBar.Width) > Size.Width)
|
||||
horizontalVisible = true;
|
||||
}
|
||||
|
||||
if (scrollBars != ScrollBars.Vertical && scrollBars != ScrollBars.Both)
|
||||
verticalVisible = false;
|
||||
if (scrollBars != ScrollBars.Horizontal && scrollBars != ScrollBars.Both)
|
||||
horizontalVisible = false;
|
||||
|
||||
if (horizontalVisible) {
|
||||
horizontalScrollBar.Minimum = 0;
|
||||
horizontalScrollBar.Maximum = gridWidth;
|
||||
@@ -4825,12 +4836,15 @@ namespace System.Windows.Forms {
|
||||
|
||||
internal void OnRowsAddedInternal (DataGridViewRowsAddedEventArgs e)
|
||||
{
|
||||
if (hover_cell != null && hover_cell.RowIndex >= e.RowIndex)
|
||||
hover_cell = null;
|
||||
|
||||
AutoResizeColumnsInternal ();
|
||||
Invalidate ();
|
||||
OnRowsAdded (e);
|
||||
}
|
||||
|
||||
protected internal virtual void OnRowsAdded (DataGridViewRowsAddedEventArgs e)
|
||||
protected virtual void OnRowsAdded (DataGridViewRowsAddedEventArgs e)
|
||||
{
|
||||
DataGridViewRowsAddedEventHandler eh = (DataGridViewRowsAddedEventHandler)(Events [RowsAddedEvent]);
|
||||
if (eh != null) eh (this, e);
|
||||
@@ -4851,14 +4865,18 @@ namespace System.Windows.Forms {
|
||||
|
||||
if (Rows.Count == 0) {
|
||||
MoveCurrentCell (-1, -1, true, false, false, true);
|
||||
hover_cell = null;
|
||||
} else if (Columns.Count == 0) {
|
||||
MoveCurrentCell (-1, -1, true, false, false, true);
|
||||
hover_cell = null;
|
||||
} else {
|
||||
int nextRowIndex = e.RowIndex;
|
||||
if (nextRowIndex >= Rows.Count)
|
||||
nextRowIndex = Rows.Count - 1;
|
||||
MoveCurrentCell (currentCell != null ? currentCell.ColumnIndex : 0, nextRowIndex,
|
||||
true, false, false, true);
|
||||
if (hover_cell != null && hover_cell.RowIndex >= e.RowIndex)
|
||||
hover_cell = null;
|
||||
}
|
||||
|
||||
Invalidate ();
|
||||
@@ -4920,15 +4938,17 @@ namespace System.Windows.Forms {
|
||||
|
||||
protected virtual void OnUserAddedRow (DataGridViewRowEventArgs e)
|
||||
{
|
||||
// Switch the current editing row with a real
|
||||
int newRowIndex = NewRowIndex;
|
||||
int currentColumnIndex = currentCell != null ? currentCell.ColumnIndex : 0;
|
||||
new_row_editing = true;
|
||||
PrepareEditingRow (false, false);
|
||||
if (DataManager != null)
|
||||
|
||||
new_row_editing = true;
|
||||
if (DataManager != null) {
|
||||
// Switch the current editing row with a real one
|
||||
if (editing_row != null) {
|
||||
Rows.RemoveInternal (editing_row);
|
||||
editing_row = null;
|
||||
}
|
||||
DataManager.AddNew (); // will raise OnListPositionChanged
|
||||
else
|
||||
MoveCurrentCell (currentColumnIndex, NewRowIndex, true, false, false, true);
|
||||
}
|
||||
|
||||
e = new DataGridViewRowEventArgs (Rows[NewRowIndex]);
|
||||
DataGridViewRowEventHandler eh = (DataGridViewRowEventHandler)(Events [UserAddedRowEvent]);
|
||||
@@ -5018,7 +5038,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
protected bool ProcessDeleteKey (Keys keyData)
|
||||
{
|
||||
if (!allowUserToDeleteRows || SelectedRows.Count == 0)
|
||||
if (!AllowUserToDeleteRows || SelectedRows.Count == 0)
|
||||
return false;
|
||||
|
||||
int index = Math.Max (selected_row - SelectedRows.Count + 1, 0);
|
||||
@@ -5032,8 +5052,8 @@ namespace System.Windows.Forms {
|
||||
if (hover_cell != null && hover_cell.OwningRow == row)
|
||||
hover_cell = null;
|
||||
|
||||
if (DataSource != null && DataSource is DataSet)
|
||||
(DataSource as DataSet).Tables[dataMember].Rows.RemoveAt (row.Index);
|
||||
if (DataManager != null)
|
||||
DataManager.RemoveAt (row.Index);
|
||||
else
|
||||
Rows.RemoveAt (row.Index);
|
||||
}
|
||||
@@ -5172,7 +5192,7 @@ namespace System.Windows.Forms {
|
||||
if (cell != null) {
|
||||
if (cell.KeyEntersEditMode (new KeyEventArgs ((Keys)m.WParam.ToInt32 ())))
|
||||
BeginEdit (true);
|
||||
if (EditingControl != null && (Msg)m.Msg == Msg.WM_KEYDOWN || (Msg)m.Msg == Msg.WM_CHAR)
|
||||
if (EditingControl != null && ((Msg)m.Msg == Msg.WM_KEYDOWN || (Msg)m.Msg == Msg.WM_CHAR))
|
||||
XplatUI.SendMessage (EditingControl.Handle, (Msg)m.Msg, m.WParam, m.LParam);
|
||||
}
|
||||
|
||||
@@ -5412,10 +5432,12 @@ namespace System.Windows.Forms {
|
||||
|
||||
if (cell != currentCell) {
|
||||
if (currentCell != null) {
|
||||
if (currentCell.IsInEditMode && !EndEdit ())
|
||||
return false;
|
||||
else if (currentCell.RowIndex == NewRowIndex && new_row_editing)
|
||||
CancelEdit ();
|
||||
if (currentCell.IsInEditMode) {
|
||||
if (!EndEdit ())
|
||||
return false;
|
||||
else if (currentCell.RowIndex == NewRowIndex && new_row_editing)
|
||||
CancelEdit ();
|
||||
}
|
||||
OnCellLeave (new DataGridViewCellEventArgs(currentCell.ColumnIndex, currentCell.RowIndex));
|
||||
OnRowLeave (new DataGridViewCellEventArgs (currentCell.ColumnIndex, currentCell.RowIndex));
|
||||
}
|
||||
@@ -5774,30 +5796,23 @@ namespace System.Windows.Forms {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
internal void PrepareEditingRow (bool cell_changed, bool column_changed)
|
||||
private void PrepareEditingRow (bool cell_changed, bool column_changed)
|
||||
{
|
||||
if (new_row_editing) {
|
||||
if (editing_row != null) {
|
||||
Rows.RemoveInternal (editing_row);
|
||||
editing_row = null;
|
||||
}
|
||||
if (new_row_editing)
|
||||
return;
|
||||
}
|
||||
|
||||
bool show = false;
|
||||
|
||||
show = ColumnCount > 0 && AllowUserToAddRows;
|
||||
|
||||
if (!show && editing_row != null) {
|
||||
Rows.RemoveInternal (editing_row);
|
||||
editing_row = null;
|
||||
if (!show) {
|
||||
RemoveEditingRow ();
|
||||
} else if (show) {
|
||||
if (editing_row != null && (cell_changed || column_changed)) {
|
||||
// The row changed, it's no longer an editing row.
|
||||
// or
|
||||
// The number of columns has changed, we need a new editing row.
|
||||
Rows.RemoveInternal (editing_row);
|
||||
editing_row = null;
|
||||
RemoveEditingRow ();
|
||||
}
|
||||
if (editing_row == null) {
|
||||
editing_row = RowTemplateFull;
|
||||
@@ -5806,6 +5821,15 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
}
|
||||
|
||||
internal void RemoveEditingRow ()
|
||||
{
|
||||
if (editing_row != null) {
|
||||
if (Rows.Contains (editing_row))
|
||||
Rows.RemoveInternal (editing_row);
|
||||
editing_row = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal DataGridViewRow EditingRow {
|
||||
get { return editing_row; }
|
||||
}
|
||||
@@ -5850,20 +5874,38 @@ namespace System.Windows.Forms {
|
||||
{
|
||||
if (type == typeof (bool))
|
||||
return new DataGridViewCheckBoxColumn ();
|
||||
else if (typeof(Bitmap).IsAssignableFrom (type))
|
||||
return new DataGridViewImageColumn ();
|
||||
|
||||
return new DataGridViewTextBoxColumn ();
|
||||
}
|
||||
|
||||
private void ClearBinding ()
|
||||
{
|
||||
columns.ClearAutoGeneratedColumns ();
|
||||
rows.Clear ();
|
||||
PrepareEditingRow (false, true);
|
||||
if (IsCurrentCellInEditMode && !EndEdit ())
|
||||
CancelEdit ();
|
||||
MoveCurrentCell (-1, -1, false, false, false, true);
|
||||
|
||||
if (DataManager != null) {
|
||||
DataManager.ListChanged -= OnListChanged;
|
||||
DataManager.PositionChanged -= OnListPositionChanged;
|
||||
columns.ClearAutoGeneratedColumns ();
|
||||
rows.Clear ();
|
||||
RemoveEditingRow ();
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetRows ()
|
||||
{
|
||||
rows.Clear ();
|
||||
RemoveEditingRow ();
|
||||
if (DataManager != null) {
|
||||
foreach (object element in DataManager.List)
|
||||
AddBoundRow (element);
|
||||
}
|
||||
PrepareEditingRow (false, true);
|
||||
OnListPositionChanged (this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void DoBinding ()
|
||||
{
|
||||
@@ -5919,6 +5961,7 @@ namespace System.Windows.Forms {
|
||||
MoveCurrentCell (0, 0, true, false, false, false);
|
||||
}
|
||||
|
||||
PrepareEditingRow (false, true);
|
||||
PerformLayout();
|
||||
Invalidate ();
|
||||
}
|
||||
@@ -6043,7 +6086,7 @@ namespace System.Windows.Forms {
|
||||
case ListChangedType.ItemChanged:
|
||||
break;
|
||||
default:
|
||||
ReBind ();
|
||||
ResetRows ();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -316,11 +316,11 @@ namespace System.Windows.Forms {
|
||||
return false;
|
||||
}
|
||||
set {
|
||||
bool changed = selected != value;
|
||||
selected = value;
|
||||
|
||||
if (value != ((State & DataGridViewElementStates.Selected) != 0)) {
|
||||
if (value != ((State & DataGridViewElementStates.Selected) != 0))
|
||||
SetState(State ^ DataGridViewElementStates.Selected);
|
||||
}
|
||||
|
||||
// If our row is selected, unselect it and select
|
||||
// the first cell in it that isn't us
|
||||
@@ -332,6 +332,9 @@ namespace System.Windows.Forms {
|
||||
else if (OwningRow.Cells.Count > 1)
|
||||
OwningRow.Cells[1].Selected = true;
|
||||
}
|
||||
|
||||
if (changed && DataGridView != null && DataGridView.IsHandleCreated)
|
||||
DataGridView.Invalidate ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,12 +700,14 @@ namespace System.Windows.Forms {
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
public virtual void PositionEditingControl (bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow)
|
||||
{
|
||||
if (setLocation && setSize)
|
||||
DataGridView.EditingControl.Bounds = cellBounds;
|
||||
else if (setLocation)
|
||||
DataGridView.EditingControl.Location = cellBounds.Location;
|
||||
else if (setSize)
|
||||
DataGridView.EditingControl.Size = cellBounds.Size;
|
||||
if (DataGridView.EditingControl != null) {
|
||||
if (setLocation && setSize)
|
||||
DataGridView.EditingControl.Bounds = cellBounds;
|
||||
else if (setLocation)
|
||||
DataGridView.EditingControl.Location = cellBounds.Location;
|
||||
else if (setSize)
|
||||
DataGridView.EditingControl.Size = cellBounds.Size;
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
@@ -873,6 +878,11 @@ namespace System.Windows.Forms {
|
||||
value = e.Value;
|
||||
}
|
||||
|
||||
if (FormattedValueType == typeof(string) && value is IFormattable && !String.IsNullOrEmpty (cellStyle.Format))
|
||||
return ((IFormattable) value).ToString (cellStyle.Format, cellStyle.FormatProvider);
|
||||
if (value != null && FormattedValueType.IsAssignableFrom (value.GetType()))
|
||||
return value;
|
||||
|
||||
if (formattedValueTypeConverter == null)
|
||||
formattedValueTypeConverter = FormattedValueTypeConverter;
|
||||
if (valueTypeConverter == null)
|
||||
@@ -1293,7 +1303,7 @@ namespace System.Windows.Forms {
|
||||
else
|
||||
valuex = value;
|
||||
|
||||
if (oldValue != value) {
|
||||
if (!Object.ReferenceEquals (oldValue, value) || !Object.Equals (oldValue, value)) {
|
||||
RaiseCellValueChanged (new DataGridViewCellEventArgs (ColumnIndex, RowIndex));
|
||||
|
||||
// Set this dirty flag back to false
|
||||
@@ -1397,13 +1407,13 @@ namespace System.Windows.Forms {
|
||||
else if (align == DataGridViewContentAlignment.BottomCenter || align == DataGridViewContentAlignment.MiddleCenter || align == DataGridViewContentAlignment.TopCenter)
|
||||
x = Math.Max (outer.X + ((outer.Width - inner.Width) / 2), outer.Left);
|
||||
else if (align == DataGridViewContentAlignment.BottomRight || align == DataGridViewContentAlignment.MiddleRight || align == DataGridViewContentAlignment.TopRight)
|
||||
x = outer.Right - inner.Width;
|
||||
x = Math.Max (outer.Right - inner.Width, outer.X);
|
||||
if (align == DataGridViewContentAlignment.TopCenter || align == DataGridViewContentAlignment.TopLeft || align == DataGridViewContentAlignment.TopRight)
|
||||
y = outer.Y;
|
||||
else if (align == DataGridViewContentAlignment.MiddleCenter || align == DataGridViewContentAlignment.MiddleLeft || align == DataGridViewContentAlignment.MiddleRight)
|
||||
y = outer.Y + (outer.Height - inner.Height) / 2;
|
||||
y = Math.Max (outer.Y + (outer.Height - inner.Height) / 2, outer.Y);
|
||||
else if (align == DataGridViewContentAlignment.BottomCenter || align == DataGridViewContentAlignment.BottomRight || align == DataGridViewContentAlignment.BottomLeft)
|
||||
y = outer.Bottom - inner.Height;
|
||||
y = Math.Max (outer.Bottom - inner.Height, outer.Y);
|
||||
|
||||
return new Rectangle (x, y, Math.Min (inner.Width, outer.Width), Math.Min (inner.Height, outer.Height));
|
||||
}
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ namespace System.Windows.Forms
|
||||
|
||||
// When we clear the column collection, all rows get deleted
|
||||
dataGridView.Rows.Clear ();
|
||||
dataGridView.PrepareEditingRow (false, true);
|
||||
dataGridView.RemoveEditingRow ();
|
||||
|
||||
RegenerateSortedList ();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace System.Windows.Forms {
|
||||
this.valuesAreIcons = valuesAreIcons;
|
||||
base.CellTemplate = new DataGridViewImageCell(valuesAreIcons);
|
||||
(base.CellTemplate as DataGridViewImageCell).ImageLayout = DataGridViewImageCellLayout.Normal;
|
||||
DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
icon = null;
|
||||
image = null;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace System.Windows.Forms
|
||||
dataGridViewRow.SetIndex (result);
|
||||
}
|
||||
dataGridViewRow.SetDataGridView (dataGridView);
|
||||
|
||||
CompleteRowCells (dataGridViewRow);
|
||||
for (int i = 0; i < dataGridViewRow.Cells.Count; i++) {
|
||||
dataGridViewRow.Cells [i].SetOwningColumn (dataGridView.Columns [i]);
|
||||
}
|
||||
@@ -147,6 +147,18 @@ namespace System.Windows.Forms
|
||||
return result;
|
||||
}
|
||||
|
||||
// Complete the rows if they are incomplete.
|
||||
private void CompleteRowCells (DataGridViewRow row)
|
||||
{
|
||||
if (row == null || DataGridView == null)
|
||||
return;
|
||||
|
||||
if (row.Cells.Count < DataGridView.ColumnCount) {
|
||||
for (int i = row.Cells.Count; i < DataGridView.ColumnCount; i++)
|
||||
row.Cells.Add ((DataGridViewCell) DataGridView.Columns[i].CellTemplate.Clone ());
|
||||
}
|
||||
}
|
||||
|
||||
public virtual int Add (DataGridViewRow dataGridViewRow)
|
||||
{
|
||||
if (dataGridView.DataSource != null)
|
||||
@@ -186,7 +198,7 @@ namespace System.Windows.Forms
|
||||
int result = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
result = Add (dataGridView.RowTemplateFull as DataGridViewRow);
|
||||
DataGridView.OnRowsAdded (new DataGridViewRowsAddedEventArgs (result - count + 1, count));
|
||||
DataGridView.OnRowsAddedInternal (new DataGridViewRowsAddedEventArgs (result - count + 1, count));
|
||||
raiseEvent = true;
|
||||
return result;
|
||||
}
|
||||
@@ -211,7 +223,7 @@ namespace System.Windows.Forms
|
||||
int lastIndex = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
lastIndex = AddCopy(indexSource);
|
||||
DataGridView.OnRowsAdded (new DataGridViewRowsAddedEventArgs (lastIndex - count + 1, count));
|
||||
DataGridView.OnRowsAddedInternal (new DataGridViewRowsAddedEventArgs (lastIndex - count + 1, count));
|
||||
raiseEvent = true;
|
||||
return lastIndex;
|
||||
}
|
||||
@@ -234,7 +246,7 @@ namespace System.Windows.Forms
|
||||
lastIndex = Add (row);
|
||||
count++;
|
||||
}
|
||||
DataGridView.OnRowsAdded (new DataGridViewRowsAddedEventArgs (lastIndex - count + 1, count));
|
||||
DataGridView.OnRowsAddedInternal (new DataGridViewRowsAddedEventArgs (lastIndex - count + 1, count));
|
||||
raiseEvent = true;
|
||||
}
|
||||
|
||||
@@ -391,10 +403,12 @@ namespace System.Windows.Forms
|
||||
{
|
||||
dataGridViewRow.SetIndex (rowIndex);
|
||||
dataGridViewRow.SetDataGridView (dataGridView);
|
||||
list[rowIndex] = dataGridViewRow;
|
||||
CompleteRowCells (dataGridViewRow);
|
||||
list.Insert (rowIndex, dataGridViewRow);
|
||||
ReIndex ();
|
||||
OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, dataGridViewRow));
|
||||
if (raiseEvent)
|
||||
DataGridView.OnRowsAdded (new DataGridViewRowsAddedEventArgs (rowIndex, 1));
|
||||
DataGridView.OnRowsAddedInternal (new DataGridViewRowsAddedEventArgs (rowIndex, 1));
|
||||
}
|
||||
|
||||
public virtual void Insert (int rowIndex, int count)
|
||||
@@ -403,7 +417,7 @@ namespace System.Windows.Forms
|
||||
raiseEvent = false;
|
||||
for (int i = 0; i < count; i++)
|
||||
Insert (index++, dataGridView.RowTemplateFull);
|
||||
DataGridView.OnRowsAdded (new DataGridViewRowsAddedEventArgs (rowIndex, count));
|
||||
DataGridView.OnRowsAddedInternal (new DataGridViewRowsAddedEventArgs (rowIndex, count));
|
||||
raiseEvent = true;
|
||||
}
|
||||
|
||||
@@ -424,7 +438,7 @@ namespace System.Windows.Forms
|
||||
int index = indexDestination;
|
||||
for (int i = 0; i < count; i++)
|
||||
InsertCopy (indexSource, index++);
|
||||
DataGridView.OnRowsAdded (new DataGridViewRowsAddedEventArgs (indexDestination, count));
|
||||
DataGridView.OnRowsAddedInternal (new DataGridViewRowsAddedEventArgs (indexDestination, count));
|
||||
raiseEvent = true;
|
||||
}
|
||||
|
||||
@@ -442,7 +456,7 @@ namespace System.Windows.Forms
|
||||
Insert (index++, row);
|
||||
count++;
|
||||
}
|
||||
DataGridView.OnRowsAdded (new DataGridViewRowsAddedEventArgs (rowIndex, count));
|
||||
DataGridView.OnRowsAddedInternal (new DataGridViewRowsAddedEventArgs (rowIndex, count));
|
||||
raiseEvent = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -999,6 +999,10 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
} else
|
||||
UpdateBounds ();
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Menu Changed
|
||||
OnUIAMenuChanged (EventArgs.Empty);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1311,6 +1315,11 @@ namespace System.Windows.Forms {
|
||||
topmost = value;
|
||||
if (IsHandleCreated)
|
||||
XplatUI.SetTopmost(window.Handle, value);
|
||||
|
||||
#if NET_2_0
|
||||
// UIA Framework: Raises internal event
|
||||
OnUIATopMostChanged ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1366,6 +1375,12 @@ namespace System.Windows.Forms {
|
||||
|
||||
XplatUI.SetWindowState(Handle, value);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
// UIA Framework: Raises internal event
|
||||
if (old_state != window_state)
|
||||
OnUIAWindowStateChanged ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3284,6 +3299,50 @@ namespace System.Windows.Forms {
|
||||
eh (this, e);
|
||||
}
|
||||
#endif
|
||||
|
||||
#region UIA Framework Events
|
||||
#if NET_2_0
|
||||
static object UIAMenuChangedEvent = new object ();
|
||||
static object UIATopMostChangedEvent = new object ();
|
||||
static object UIAWindowStateChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIAMenuChanged {
|
||||
add { Events.AddHandler (UIAMenuChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIAMenuChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal event EventHandler UIATopMostChanged {
|
||||
add { Events.AddHandler (UIATopMostChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIATopMostChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal event EventHandler UIAWindowStateChanged {
|
||||
add { Events.AddHandler (UIAWindowStateChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIAWindowStateChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIAMenuChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIAMenuChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
|
||||
internal void OnUIATopMostChanged ()
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIATopMostChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
internal void OnUIAWindowStateChanged ()
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIAWindowStateChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, EventArgs.Empty);
|
||||
}
|
||||
#endif
|
||||
#endregion // UIA Framework Events
|
||||
#endregion // Events
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ namespace System.Windows.Forms
|
||||
internal IntPtr menu_handle = IntPtr.Zero;
|
||||
internal Menu parent_menu = null;
|
||||
System.Drawing.Rectangle rect;
|
||||
// UIA Framework Note: Used to keep track of expanded menus
|
||||
internal Control Wnd;
|
||||
internal MenuTracker tracker;
|
||||
|
||||
@@ -134,6 +135,7 @@ namespace System.Windows.Forms
|
||||
|
||||
#region Private Properties
|
||||
|
||||
// UIA Framework Note: Used to obtain menu bounds
|
||||
internal System.Drawing.Rectangle Rect {
|
||||
get { return rect; }
|
||||
}
|
||||
@@ -331,6 +333,7 @@ namespace System.Windows.Forms
|
||||
#endregion Public Methods
|
||||
static object MenuChangedEvent = new object ();
|
||||
|
||||
// UIA Framework Note: Used to track changes in MenuItemCollection
|
||||
internal event EventHandler MenuChanged {
|
||||
add { Events.AddHandler (MenuChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (MenuChangedEvent, value); }
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace System.Windows.Forms {
|
||||
When writing this code the Wine project was of great help to
|
||||
understand the logic behind some Win32 issues. Thanks to them. Jordi,
|
||||
*/
|
||||
// UIA Framework Note: This class used by UIA for its mouse action methods.
|
||||
internal class MenuTracker {
|
||||
|
||||
internal bool active;
|
||||
@@ -136,6 +137,7 @@ namespace System.Windows.Forms {
|
||||
return item;
|
||||
}
|
||||
|
||||
// UIA Framework Note: Used to expand/collapse MenuItems
|
||||
public bool OnMouseDown (MouseEventArgs args)
|
||||
{
|
||||
MenuItem item = GetItemAtXY (args.X, args.Y);
|
||||
@@ -167,6 +169,7 @@ namespace System.Windows.Forms {
|
||||
return true;
|
||||
}
|
||||
|
||||
// UIA Framework Note: Used to select MenuItems
|
||||
public void OnMotion (MouseEventArgs args)
|
||||
{
|
||||
// Windows helpfully sends us MOUSEMOVE messages when any key is pressed.
|
||||
@@ -214,6 +217,7 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
}
|
||||
|
||||
// UIA Framework Note: Used to expand/collapse MenuItems
|
||||
public void OnMouseUp (MouseEventArgs args)
|
||||
{
|
||||
/* mouse down dont comes from menu */
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace System.Windows.Forms
|
||||
private int menuheight;
|
||||
private bool menubar;
|
||||
private MenuMerge mergetype;
|
||||
// UIA Framework Note: Used to obtain item bounds
|
||||
internal Rectangle bounds;
|
||||
|
||||
public MenuItem (): base (null)
|
||||
@@ -167,6 +168,66 @@ namespace System.Windows.Forms
|
||||
add { Events.AddHandler (SelectEvent, value); }
|
||||
remove { Events.RemoveHandler (SelectEvent, value); }
|
||||
}
|
||||
|
||||
#region UIA Framework Events
|
||||
#if NET_2_0
|
||||
static object UIACheckedChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIACheckedChanged {
|
||||
add { Events.AddHandler (UIACheckedChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIACheckedChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIACheckedChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIACheckedChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
|
||||
static object UIARadioCheckChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIARadioCheckChanged {
|
||||
add { Events.AddHandler (UIARadioCheckChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIARadioCheckChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIARadioCheckChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIARadioCheckChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
|
||||
static object UIAEnabledChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIAEnabledChanged {
|
||||
add { Events.AddHandler (UIAEnabledChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIAEnabledChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIAEnabledChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIAEnabledChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
|
||||
static object UIATextChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIATextChanged {
|
||||
add { Events.AddHandler (UIATextChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIATextChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIATextChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIATextChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
#endregion // Events
|
||||
|
||||
#region Public Properties
|
||||
@@ -188,7 +249,16 @@ namespace System.Windows.Forms
|
||||
[DefaultValue(false)]
|
||||
public bool Checked {
|
||||
get { return checked_; }
|
||||
set { checked_ = value; }
|
||||
set {
|
||||
if (checked_ == value)
|
||||
return;
|
||||
|
||||
checked_ = value;
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Checked Changed
|
||||
OnUIACheckedChanged (EventArgs.Empty);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(false)]
|
||||
@@ -206,6 +276,10 @@ namespace System.Windows.Forms
|
||||
return;
|
||||
|
||||
enabled = value;
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Enabled Changed
|
||||
OnUIAEnabledChanged (EventArgs.Empty);
|
||||
#endif
|
||||
Invalidate ();
|
||||
}
|
||||
}
|
||||
@@ -283,7 +357,16 @@ namespace System.Windows.Forms
|
||||
[DefaultValue(false)]
|
||||
public bool RadioCheck {
|
||||
get { return radiocheck; }
|
||||
set { radiocheck = value; }
|
||||
set {
|
||||
if (radiocheck == value)
|
||||
return;
|
||||
|
||||
radiocheck = value;
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Checked Changed
|
||||
OnUIARadioCheckChanged (EventArgs.Empty);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(Shortcut.None)]
|
||||
@@ -316,6 +399,10 @@ namespace System.Windows.Forms
|
||||
separator = true;
|
||||
else
|
||||
separator = false;
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Text Changed
|
||||
OnUIATextChanged (EventArgs.Empty);
|
||||
#endif
|
||||
|
||||
ProcessMnemonic ();
|
||||
Invalidate ();
|
||||
|
||||
@@ -524,6 +524,28 @@ namespace System.Windows.Forms
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
internal void UIAPerformClick (ToolBarButton button)
|
||||
{
|
||||
ToolBarItem previous_item = current_item;
|
||||
current_item = null;
|
||||
|
||||
foreach (ToolBarItem item in items)
|
||||
if (item.Button == button) {
|
||||
current_item = item;
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
if (current_item == null)
|
||||
throw new ArgumentException ("button", "The button specified is not part of this toolbar");
|
||||
OnButtonClick (new ToolBarButtonClickEventArgs (button));
|
||||
} finally {
|
||||
current_item = previous_item;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
protected virtual void OnButtonClick (ToolBarButtonClickEventArgs e)
|
||||
{
|
||||
if (e.Button.Style == ToolBarButtonStyle.ToggleButton) {
|
||||
@@ -1110,6 +1132,25 @@ namespace System.Windows.Forms
|
||||
private bool redraw; // Flag if needs to redraw after add/remove operations
|
||||
#endregion
|
||||
|
||||
#region UIA Framework Events
|
||||
#if NET_2_0
|
||||
static object UIACollectionChangedEvent = new object ();
|
||||
|
||||
internal event CollectionChangeEventHandler UIACollectionChanged {
|
||||
add { owner.Events.AddHandler (UIACollectionChangedEvent, value); }
|
||||
remove { owner.Events.RemoveHandler (UIACollectionChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIACollectionChanged (CollectionChangeEventArgs e)
|
||||
{
|
||||
CollectionChangeEventHandler eh
|
||||
= (CollectionChangeEventHandler) owner.Events [UIACollectionChangedEvent];
|
||||
if (eh != null)
|
||||
eh (owner, e);
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
#region constructors
|
||||
public ToolBarButtonCollection (ToolBar owner)
|
||||
{
|
||||
@@ -1132,9 +1173,20 @@ namespace System.Windows.Forms
|
||||
public virtual ToolBarButton this [int index] {
|
||||
get { return (ToolBarButton) list [index]; }
|
||||
set {
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Button Removed
|
||||
OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, index));
|
||||
#endif
|
||||
|
||||
value.SetParent (owner);
|
||||
list [index] = value;
|
||||
owner.Redraw (true);
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
// UIA Framework Event: Button Added
|
||||
OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, index));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1189,6 +1241,12 @@ namespace System.Windows.Forms
|
||||
result = list.Add (button);
|
||||
if (redraw)
|
||||
owner.Redraw (true);
|
||||
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Button Added
|
||||
OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, result));
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1209,6 +1267,11 @@ namespace System.Windows.Forms
|
||||
{
|
||||
list.Clear ();
|
||||
owner.Redraw (false);
|
||||
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Button Cleared
|
||||
OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, -1));
|
||||
#endif
|
||||
}
|
||||
|
||||
public bool Contains (ToolBarButton button)
|
||||
@@ -1294,6 +1357,11 @@ namespace System.Windows.Forms
|
||||
{
|
||||
list.Insert (index, button);
|
||||
owner.Redraw (true);
|
||||
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Button Added
|
||||
OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, index));
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Remove (ToolBarButton button)
|
||||
@@ -1306,6 +1374,11 @@ namespace System.Windows.Forms
|
||||
{
|
||||
list.RemoveAt (index);
|
||||
owner.Redraw (true);
|
||||
|
||||
#if NET_2_0
|
||||
// UIA Framework Event: Button Removed
|
||||
OnUIACollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, index));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
@@ -262,6 +262,11 @@ namespace System.Windows.Forms
|
||||
return;
|
||||
|
||||
text = value;
|
||||
|
||||
#if NET_2_0
|
||||
OnUIATextChanged (EventArgs.Empty);
|
||||
#endif
|
||||
|
||||
if (Parent != null)
|
||||
Parent.Redraw (true);
|
||||
}
|
||||
@@ -311,9 +316,25 @@ namespace System.Windows.Forms
|
||||
if (Parent != null)
|
||||
Parent.Invalidate (Rectangle);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
static object UIATextChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIATextChanged {
|
||||
add { Events.AddHandler (UIATextChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIATextChangedEvent, value); }
|
||||
}
|
||||
|
||||
protected virtual void OnUIATextChanged (EventArgs e)
|
||||
{
|
||||
EventHandler eh = (EventHandler)(Events [UIATextChangedEvent]);
|
||||
if (eh != null)
|
||||
eh (this, e);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
|
||||
#region methods
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
|
||||
@@ -205,6 +205,24 @@ namespace System.Windows.Forms
|
||||
|
||||
#endregion // Events
|
||||
|
||||
#region UIA FrameWork Events
|
||||
#if NET_2_0
|
||||
static object UIAValueParamChangedEvent = new object ();
|
||||
|
||||
internal event EventHandler UIAValueParamChanged {
|
||||
add { Events.AddHandler (UIAValueParamChangedEvent, value); }
|
||||
remove { Events.RemoveHandler (UIAValueParamChangedEvent, value); }
|
||||
}
|
||||
|
||||
internal void OnUIAValueParamChanged ()
|
||||
{
|
||||
EventHandler eh = (EventHandler) Events [UIAValueParamChangedEvent];
|
||||
if (eh != null)
|
||||
eh (this, EventArgs.Empty);
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
public TrackBar ()
|
||||
{
|
||||
orientation = Orientation.Horizontal;
|
||||
@@ -364,6 +382,10 @@ namespace System.Windows.Forms
|
||||
#endif
|
||||
|
||||
largeChange = value;
|
||||
|
||||
#if NET_2_0
|
||||
OnUIAValueParamChanged ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,6 +401,10 @@ namespace System.Windows.Forms
|
||||
minimum = maximum;
|
||||
|
||||
Refresh ();
|
||||
|
||||
#if NET_2_0
|
||||
OnUIAValueParamChanged ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -396,6 +422,10 @@ namespace System.Windows.Forms
|
||||
maximum = minimum;
|
||||
|
||||
Refresh ();
|
||||
|
||||
#if NET_2_0
|
||||
OnUIAValueParamChanged ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -461,6 +491,10 @@ namespace System.Windows.Forms
|
||||
#endif
|
||||
if (smallChange != value) {
|
||||
smallChange = value;
|
||||
|
||||
#if NET_2_0
|
||||
OnUIAValueParamChanged ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,14 +707,16 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LargeIncrement ()
|
||||
// Used by UIA implementation, so making internal
|
||||
internal void LargeIncrement ()
|
||||
{
|
||||
UpdatePos (position + LargeChange, true);
|
||||
Invalidate (thumb_area);
|
||||
OnScroll (new EventArgs ());
|
||||
}
|
||||
|
||||
private void LargeDecrement ()
|
||||
// Used by UIA implementation, so making internal
|
||||
internal void LargeDecrement ()
|
||||
{
|
||||
UpdatePos (position - LargeChange, true);
|
||||
Invalidate (thumb_area);
|
||||
|
||||
@@ -534,6 +534,8 @@ namespace System.Windows.Forms
|
||||
public TreeNode NextVisibleNode {
|
||||
get {
|
||||
OpenTreeNodeEnumerator o = new OpenTreeNodeEnumerator (this);
|
||||
o.MoveNext (); // move to the node itself
|
||||
|
||||
if (!o.MoveNext ())
|
||||
return null;
|
||||
TreeNode c = o.CurrentNode;
|
||||
@@ -607,6 +609,8 @@ namespace System.Windows.Forms
|
||||
public TreeNode PrevVisibleNode {
|
||||
get {
|
||||
OpenTreeNodeEnumerator o = new OpenTreeNodeEnumerator (this);
|
||||
o.MovePrevious (); // move to the node itself
|
||||
|
||||
if (!o.MovePrevious ())
|
||||
return null;
|
||||
TreeNode c = o.CurrentNode;
|
||||
|
||||
@@ -806,19 +806,12 @@ namespace System.Windows.Forms {
|
||||
|
||||
public void CollapseAll ()
|
||||
{
|
||||
TreeNode walk = TopNode;
|
||||
|
||||
if (walk == null)
|
||||
return;
|
||||
|
||||
while (walk.parent != root_node)
|
||||
walk = walk.parent;
|
||||
|
||||
BeginUpdate ();
|
||||
root_node.CollapseAll ();
|
||||
EndUpdate ();
|
||||
|
||||
SetTop (walk);
|
||||
if (IsHandleCreated && vbar.VisibleInternal)
|
||||
vbar.Value = vbar.Maximum - VisibleCount + 1;
|
||||
}
|
||||
|
||||
public TreeNode GetNodeAt (Point pt) {
|
||||
@@ -1835,25 +1828,22 @@ namespace System.Windows.Forms {
|
||||
|
||||
bool vert = false;
|
||||
bool horz = false;
|
||||
int height = -1;
|
||||
int height = 0;
|
||||
int width = -1;
|
||||
|
||||
int item_height = ActualItemHeight;
|
||||
if (scrollable) {
|
||||
OpenTreeNodeEnumerator walk = new OpenTreeNodeEnumerator (root_node);
|
||||
|
||||
while (walk.MoveNext ()) {
|
||||
int r = walk.CurrentNode.Bounds.Right;
|
||||
int b = walk.CurrentNode.Bounds.Bottom;
|
||||
|
||||
if (r > width)
|
||||
width = r;
|
||||
if (b > height)
|
||||
height = b;
|
||||
|
||||
height += item_height;
|
||||
}
|
||||
|
||||
// Remove scroll adjustments
|
||||
if (nodes.Count > 0)
|
||||
height -= nodes [0].Bounds.Top;
|
||||
height -= item_height; // root_node adjustment
|
||||
width += hbar_offset;
|
||||
|
||||
if (height > ClientRectangle.Height) {
|
||||
@@ -1899,6 +1889,7 @@ namespace System.Windows.Forms {
|
||||
skipped_nodes = 0;
|
||||
RecalculateVisibleOrder (root_node);
|
||||
vbar.Visible = false;
|
||||
vbar.Value = 0;
|
||||
vbar_bounds_set = false;
|
||||
}
|
||||
|
||||
@@ -1951,6 +1942,9 @@ namespace System.Windows.Forms {
|
||||
|
||||
private void SetVScrollPos (int pos, TreeNode new_top)
|
||||
{
|
||||
if (!vbar.VisibleInternal)
|
||||
return;
|
||||
|
||||
if (pos < 0)
|
||||
pos = 0;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace System.Windows.Forms
|
||||
bool isWebBrowserContextMenuEnabled;
|
||||
object objectForScripting;
|
||||
bool webBrowserShortcutsEnabled;
|
||||
bool scrollbarsEnabled;
|
||||
bool scrollbarsEnabled = true;
|
||||
|
||||
WebBrowserReadyState readyState;
|
||||
|
||||
|
||||
@@ -205,7 +205,8 @@ namespace System.Windows.Forms {
|
||||
private static IntPtr PRIMARY;
|
||||
//private static IntPtr DIB;
|
||||
private static IntPtr OEMTEXT;
|
||||
private static IntPtr UNICODETEXT;
|
||||
private static IntPtr UTF8_STRING;
|
||||
private static IntPtr UTF16_STRING;
|
||||
private static IntPtr RICHTEXTFORMAT;
|
||||
private static IntPtr TARGETS;
|
||||
|
||||
@@ -619,6 +620,7 @@ namespace System.Windows.Forms {
|
||||
"PRIMARY",
|
||||
"COMPOUND_TEXT",
|
||||
"UTF8_STRING",
|
||||
"UTF16_STRING",
|
||||
"RICHTEXTFORMAT",
|
||||
"TARGETS",
|
||||
"_SWF_AsyncAtom",
|
||||
@@ -693,7 +695,8 @@ namespace System.Windows.Forms {
|
||||
CLIPBOARD = atoms [off++];
|
||||
PRIMARY = atoms [off++];
|
||||
OEMTEXT = atoms [off++];
|
||||
UNICODETEXT = atoms [off++];
|
||||
UTF8_STRING = atoms [off++];
|
||||
UTF16_STRING = atoms [off++];
|
||||
RICHTEXTFORMAT = atoms [off++];
|
||||
TARGETS = atoms [off++];
|
||||
AsyncAtom = atoms [off++];
|
||||
@@ -1248,7 +1251,12 @@ namespace System.Windows.Forms {
|
||||
// FIXME - convert pixmap to image
|
||||
} else if (property == OEMTEXT) {
|
||||
Clipboard.Item = Marshal.PtrToStringAnsi(prop);
|
||||
} else if (property == UNICODETEXT) {
|
||||
} else if (property == UTF8_STRING) {
|
||||
byte [] buffer = new byte [(int)nitems];
|
||||
for (int i = 0; i < (int)nitems; i++)
|
||||
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));
|
||||
} else if (property == RICHTEXTFORMAT)
|
||||
Clipboard.Item = Marshal.PtrToStringAnsi(prop);
|
||||
@@ -1422,8 +1430,8 @@ namespace System.Windows.Forms {
|
||||
//
|
||||
if (in_doevents ||
|
||||
(Application.MWFThread.Current.Context != null &&
|
||||
Application.MWFThread.Current.Context.MainForm != null &&
|
||||
Application.MWFThread.Current.Context.MainForm.IsLoaded)) {
|
||||
(Application.MWFThread.Current.Context.MainForm == null ||
|
||||
Application.MWFThread.Current.Context.MainForm.IsLoaded))) {
|
||||
timer.Busy = true;
|
||||
timer.Update (now);
|
||||
timer.FireTick ();
|
||||
@@ -1703,7 +1711,8 @@ namespace System.Windows.Forms {
|
||||
if (Clipboard.Item is String) {
|
||||
atoms[atom_count++] = (int)Atom.XA_STRING;
|
||||
atoms[atom_count++] = (int)OEMTEXT;
|
||||
atoms[atom_count++] = (int)UNICODETEXT;
|
||||
atoms[atom_count++] = (int)UTF8_STRING;
|
||||
atoms[atom_count++] = (int)UTF16_STRING;
|
||||
atoms[atom_count++] = (int)RICHTEXTFORMAT;
|
||||
} else if (Clipboard.Item is Image) {
|
||||
atoms[atom_count++] = (int)Atom.XA_PIXMAP;
|
||||
@@ -1737,7 +1746,7 @@ namespace System.Windows.Forms {
|
||||
while (Marshal.ReadByte(buffer, buflen) != 0) {
|
||||
buflen++;
|
||||
}
|
||||
} else if (xevent.SelectionRequestEvent.target == UNICODETEXT) {
|
||||
} else if (xevent.SelectionRequestEvent.target == UTF16_STRING) {
|
||||
Byte [] bytes;
|
||||
|
||||
bytes = Encoding.Unicode.GetBytes ((string)Clipboard.Source);
|
||||
@@ -2612,7 +2621,7 @@ namespace System.Windows.Forms {
|
||||
//else if (format == "PenData" ) return 10;
|
||||
//else if (format == "RiffAudio" ) return 11;
|
||||
//else if (format == "WaveAudio" ) return 12;
|
||||
else if (format == "UnicodeText" ) return UNICODETEXT.ToInt32();
|
||||
else if (format == "UnicodeText" ) return UTF16_STRING.ToInt32();
|
||||
//else if (format == "EnhancedMetafile" ) return 14;
|
||||
//else if (format == "FileDrop" ) return 15;
|
||||
//else if (format == "Locale" ) return 16;
|
||||
@@ -4565,7 +4574,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
XGetWindowProperty(DisplayHandle, handle,
|
||||
_NET_WM_NAME, IntPtr.Zero, new IntPtr (1), false,
|
||||
UNICODETEXT, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
|
||||
UTF8_STRING, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
|
||||
|
||||
if ((long)nitems > 0 && prop != IntPtr.Zero) {
|
||||
text = Marshal.PtrToStringUni (prop, (int)nitems);
|
||||
@@ -6018,7 +6027,7 @@ namespace System.Windows.Forms {
|
||||
hwnd = Hwnd.ObjectFromHandle(handle);
|
||||
|
||||
lock (XlibLock) {
|
||||
XChangeProperty(DisplayHandle, hwnd.whole_window, _NET_WM_NAME, UNICODETEXT, 8,
|
||||
XChangeProperty(DisplayHandle, hwnd.whole_window, _NET_WM_NAME, UTF8_STRING, 8,
|
||||
PropertyMode.Replace, text, Encoding.UTF8.GetByteCount (text));
|
||||
|
||||
// XXX this has problems with UTF8.
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
2009-02-04 Marek Habersack <[email protected]>
|
||||
|
||||
* SQLite3.cs, SQLite3_UTF16.cs, SQLiteBase.cs, SQLiteFunction.cs,
|
||||
UnsafeNativeMethods.cs: fixes for custom functions and collations
|
||||
creation with sqlite3. Fixes bug #470042. Patch from John Millikin
|
||||
<[email protected]>, thanks!
|
||||
|
||||
2008-12-08 Zoltan Varga <[email protected]>
|
||||
|
||||
* SQLite3.cs: Avoid IntPtr.ToInt32 () to convert between IntPtr's and integers
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace Mono.Data.Sqlite
|
||||
{
|
||||
int n = UnsafeNativeMethods.sqlite3_close(_sql);
|
||||
if (n > 0) throw new SqliteException(n, SqliteLastError());
|
||||
SqliteFunction.UnbindFunctions(this, _functionsArray);
|
||||
}
|
||||
_sql = IntPtr.Zero;
|
||||
}
|
||||
@@ -511,32 +510,16 @@ namespace Mono.Data.Sqlite
|
||||
return UnsafeNativeMethods.sqlite3_aggregate_count(context);
|
||||
}
|
||||
|
||||
internal override IntPtr CreateFunction(string strFunction, int nArgs, SqliteCallback func, SqliteCallback funcstep, SqliteCallback funcfinal)
|
||||
internal override void CreateFunction(string strFunction, int nArgs, SqliteCallback func, SqliteCallback funcstep, SqliteFinalCallback funcfinal)
|
||||
{
|
||||
IntPtr nCookie;
|
||||
|
||||
// FIXME: Cookie must be allocated in C# and passed as a parameter to the Sqlite function
|
||||
int n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 1, func, funcstep, funcfinal, out nCookie);
|
||||
int n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal);
|
||||
if (n > 0) throw new SqliteException(n, SqliteLastError());
|
||||
|
||||
return nCookie;
|
||||
}
|
||||
|
||||
internal override IntPtr CreateCollation(string strCollation, SqliteCollation func)
|
||||
internal override void CreateCollation(string strCollation, SqliteCollation func)
|
||||
{
|
||||
IntPtr nCookie;
|
||||
|
||||
// FIXME: Cookie must be allocated in C# and passed as a parameter to the Sqlite function
|
||||
int n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 1, 0, func, out nCookie);
|
||||
int n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 1, IntPtr.Zero, func);
|
||||
if (n > 0) throw new SqliteException(n, SqliteLastError());
|
||||
|
||||
return nCookie;
|
||||
}
|
||||
|
||||
internal override void FreeFunction(IntPtr nCookie)
|
||||
{
|
||||
// FIXME: must be handled in C#, this function does not exist in the mainstream sqlite3
|
||||
UnsafeNativeMethods.sqlite3_function_free_callbackcookie(nCookie);
|
||||
}
|
||||
|
||||
internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength)
|
||||
|
||||
@@ -131,28 +131,16 @@ namespace Mono.Data.Sqlite
|
||||
return ToString(UnsafeNativeMethods.sqlite3_column_table_name16(stmt._sqlite_stmt, index));
|
||||
}
|
||||
|
||||
internal override IntPtr CreateFunction(string strFunction, int nArgs, SqliteCallback func, SqliteCallback funcstep, SqliteCallback funcfinal)
|
||||
internal override void CreateFunction(string strFunction, int nArgs, SqliteCallback func, SqliteCallback funcstep, SqliteFinalCallback funcfinal)
|
||||
{
|
||||
// FIXME: the function interface below is not supported in the mainstream version of sqlite. Need to rewrite the C# API to
|
||||
// use the mainstream sqlite. The cookie needs to be allocated in C#
|
||||
IntPtr nCookie;
|
||||
|
||||
int n = UnsafeNativeMethods.sqlite3_create_function16(_sql, strFunction, nArgs, 4, func, funcstep, funcfinal, out nCookie);
|
||||
int n = UnsafeNativeMethods.sqlite3_create_function16(_sql, strFunction, nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal);
|
||||
if (n > 0) throw new SqliteException(n, SqliteLastError());
|
||||
|
||||
return nCookie;
|
||||
}
|
||||
|
||||
internal override IntPtr CreateCollation(string strCollation, SqliteCollation func)
|
||||
internal override void CreateCollation(string strCollation, SqliteCollation func)
|
||||
{
|
||||
// FIXME: the function interface below is not supported in the mainstream version of sqlite. Need to rewrite the C# API to
|
||||
// use the mainstream sqlite. The cookie needs to be allocated in C#
|
||||
IntPtr nCookie;
|
||||
|
||||
int n = UnsafeNativeMethods.sqlite3_create_collation16(_sql, strCollation, 4, 0, func, out nCookie);
|
||||
int n = UnsafeNativeMethods.sqlite3_create_collation16(_sql, strCollation, 4, IntPtr.Zero, func);
|
||||
if (n > 0) throw new SqliteException(n, SqliteLastError());
|
||||
|
||||
return nCookie;
|
||||
}
|
||||
|
||||
internal override string GetParamValueText(IntPtr ptr)
|
||||
|
||||
@@ -152,9 +152,8 @@ namespace Mono.Data.Sqlite
|
||||
internal abstract DateTime GetDateTime(SqliteStatement stmt, int index);
|
||||
internal abstract bool IsNull(SqliteStatement stmt, int index);
|
||||
|
||||
internal abstract IntPtr CreateCollation(string strCollation, SqliteCollation func);
|
||||
internal abstract IntPtr CreateFunction(string strFunction, int nArgs, SqliteCallback func, SqliteCallback funcstep, SqliteCallback funcfinal);
|
||||
internal abstract void FreeFunction(IntPtr cookie);
|
||||
internal abstract void CreateCollation(string strCollation, SqliteCollation func);
|
||||
internal abstract void CreateFunction(string strFunction, int nArgs, SqliteCallback func, SqliteCallback funcstep, SqliteFinalCallback funcfinal);
|
||||
|
||||
internal abstract int AggregateCount(IntPtr context);
|
||||
internal abstract IntPtr AggregateContext(IntPtr context);
|
||||
|
||||
@@ -76,6 +76,11 @@ namespace Mono.Data.Sqlite
|
||||
/// <param name="argsptr">A pointer to the array of argument pointers</param>
|
||||
internal delegate void SqliteCallback(IntPtr context, int nArgs, IntPtr argsptr);
|
||||
/// <summary>
|
||||
/// An internal callback delegate declaration.
|
||||
/// </summary>
|
||||
/// <param name="context">Raw context pointer for the user function</param>
|
||||
internal delegate void SqliteFinalCallback(IntPtr context);
|
||||
/// <summary>
|
||||
/// Internal callback delegate for implementing collation sequences
|
||||
/// </summary>
|
||||
/// <param name="len1">Length of the string pv1</param>
|
||||
@@ -109,10 +114,6 @@ namespace Mono.Data.Sqlite
|
||||
/// </summary>
|
||||
private SqliteBase _base;
|
||||
/// <summary>
|
||||
/// Used internally to keep track of memory allocated for aggregate functions
|
||||
/// </summary>
|
||||
private IntPtr _interopCookie;
|
||||
/// <summary>
|
||||
/// Internal array used to keep track of aggregate function context data
|
||||
/// </summary>
|
||||
private Dictionary<long, object> _contextDataList;
|
||||
@@ -128,7 +129,7 @@ namespace Mono.Data.Sqlite
|
||||
/// <summary>
|
||||
/// Holds a reference to the callback function for finalizing an aggregate function
|
||||
/// </summary>
|
||||
private SqliteCallback _FinalFunc;
|
||||
private SqliteFinalCallback _FinalFunc;
|
||||
/// <summary>
|
||||
/// Holds a reference to the callback function for collation sequences
|
||||
/// </summary>
|
||||
@@ -380,9 +381,7 @@ namespace Mono.Data.Sqlite
|
||||
/// An internal aggregate Final function callback, which wraps the context pointer and calls the virtual Final() method.
|
||||
/// </summary>
|
||||
/// <param name="context">A raw context pointer</param>
|
||||
/// <param name="nArgs">Not used, always zero</param>
|
||||
/// <param name="argsptr">Not used, always zero</param>
|
||||
internal void FinalCallback(IntPtr context, int nArgs, IntPtr argsptr)
|
||||
internal void FinalCallback(IntPtr context)
|
||||
{
|
||||
long n = (long)_base.AggregateContext(context);
|
||||
object obj = null;
|
||||
@@ -524,10 +523,6 @@ namespace Mono.Data.Sqlite
|
||||
/// It is done this way so that all user-defined functions will access the database using the same encoding scheme
|
||||
/// as the connection (UTF-8 or UTF-16).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The wrapper functions that interop with Sqlite will create a unique cooke value, which internally is a pointer to
|
||||
/// all the wrapped callback functions. The interop function uses it to map CDecl callbacks to StdCall callbacks.
|
||||
/// </remarks>
|
||||
/// <param name="sqlbase">The base object on which the functions are to bind</param>
|
||||
/// <returns>Returns an array of functions which the connection object should retain until the connection is closed.</returns>
|
||||
internal static SqliteFunction[] BindFunctions(SqliteBase sqlbase)
|
||||
@@ -541,15 +536,13 @@ namespace Mono.Data.Sqlite
|
||||
f._base = sqlbase;
|
||||
f._InvokeFunc = (pr.FuncType == FunctionType.Scalar) ? new SqliteCallback(f.ScalarCallback) : null;
|
||||
f._StepFunc = (pr.FuncType == FunctionType.Aggregate) ? new SqliteCallback(f.StepCallback) : null;
|
||||
f._FinalFunc = (pr.FuncType == FunctionType.Aggregate) ? new SqliteCallback(f.FinalCallback) : null;
|
||||
f._FinalFunc = (pr.FuncType == FunctionType.Aggregate) ? new SqliteFinalCallback(f.FinalCallback) : null;
|
||||
f._CompareFunc = (pr.FuncType == FunctionType.Collation) ? new SqliteCollation(f.CompareCallback) : null;
|
||||
|
||||
if (pr.FuncType != FunctionType.Collation)
|
||||
f._interopCookie = sqlbase.CreateFunction(pr.Name, pr.Arguments, f._InvokeFunc, f._StepFunc, f._FinalFunc);
|
||||
sqlbase.CreateFunction(pr.Name, pr.Arguments, f._InvokeFunc, f._StepFunc, f._FinalFunc);
|
||||
else
|
||||
f._interopCookie = sqlbase.CreateCollation(pr.Name, f._CompareFunc);
|
||||
|
||||
|
||||
sqlbase.CreateCollation(pr.Name, f._CompareFunc);
|
||||
lFunctions.Add(f);
|
||||
}
|
||||
|
||||
@@ -557,28 +550,7 @@ namespace Mono.Data.Sqlite
|
||||
lFunctions.CopyTo(arFunctions, 0);
|
||||
|
||||
return arFunctions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Issued after the base connection is closed, this function cleans up all user-defined functions and disposes of them.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Cleaning up here is done mainly because of the interop wrapper. It allocated memory to hold a reference to all the
|
||||
/// delegates, and now must free that memory.
|
||||
/// Freeing is done after the connection is closed to ensure no callbacks get hit after we've freed the cookie.
|
||||
/// </remarks>
|
||||
/// <param name="sqlbase">The base Sqlite connection object</param>
|
||||
/// <param name="ar">An array of user-defined functions for this object</param>
|
||||
internal static void UnbindFunctions(SqliteBase sqlbase, SqliteFunction[] ar)
|
||||
{
|
||||
if (ar == null) return;
|
||||
|
||||
int x = ar.Length;
|
||||
for (int n = 0; n < x; n++)
|
||||
{
|
||||
sqlbase.FreeFunction(ar[n]._interopCookie);
|
||||
ar[n].Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,13 +158,10 @@ namespace Mono.Data.Sqlite
|
||||
internal static extern int sqlite3_reset(IntPtr stmt);
|
||||
|
||||
[DllImport(SQLITE_DLL)]
|
||||
internal static extern int sqlite3_create_collation(IntPtr db, byte[] strName, int nType, int nArgs, SqliteCollation func, out IntPtr nCookie);
|
||||
internal static extern int sqlite3_create_collation(IntPtr db, byte[] strName, int eTextRep, IntPtr ctx, SqliteCollation fcompare);
|
||||
|
||||
[DllImport(SQLITE_DLL)]
|
||||
internal static extern int sqlite3_create_function(IntPtr db, byte[] strName, int nArgs, int nType, SqliteCallback func, SqliteCallback fstep, SqliteCallback ffinal, out IntPtr nCookie);
|
||||
|
||||
[DllImport(SQLITE_DLL)]
|
||||
internal static extern void sqlite3_function_free_callbackcookie(IntPtr nCookie);
|
||||
internal static extern int sqlite3_create_function(IntPtr db, byte[] strName, int nArgs, int eTextRep, IntPtr app, SqliteCallback func, SqliteCallback fstep, SqliteFinalCallback ffinal);
|
||||
|
||||
[DllImport(SQLITE_DLL)]
|
||||
internal static extern int sqlite3_aggregate_count(IntPtr context);
|
||||
@@ -257,10 +254,10 @@ namespace Mono.Data.Sqlite
|
||||
internal static extern IntPtr sqlite3_column_decltype16(IntPtr stmt, int index, out int len);
|
||||
|
||||
[DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
|
||||
internal static extern int sqlite3_create_collation16(IntPtr db, string strName, int nType, int nArgs, SqliteCollation func, out IntPtr nCookie);
|
||||
internal static extern int sqlite3_create_collation16(IntPtr db, string strName, int eTextRep, IntPtr ctx, SqliteCollation fcompare);
|
||||
|
||||
[DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
|
||||
internal static extern int sqlite3_create_function16(IntPtr db, string strName, int nArgs, int nType, SqliteCallback func, SqliteCallback funcstep, SqliteCallback funcfinal, out IntPtr nCookie);
|
||||
internal static extern int sqlite3_create_function16(IntPtr db, string strName, int nArgs, int eTextRep, IntPtr app, SqliteCallback func, SqliteCallback funcstep, SqliteFinalCallback funcfinal);
|
||||
|
||||
[DllImport(SQLITE_DLL)]
|
||||
internal static extern IntPtr sqlite3_value_text16(IntPtr p);
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-01-24 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Mono.Data.SybaseClient/SybaseConnection.cs: adapt to changes in TdsConnectionPool.
|
||||
|
||||
2008-09-06 Daniel Morgan <[email protected]>
|
||||
|
||||
* Mono.Data.SybaseClient/SybaseClientFactory.cs:
|
||||
|
||||
@@ -284,11 +284,7 @@ namespace Mono.Data.SybaseClient {
|
||||
|
||||
if (tds != null && tds.IsConnected) {
|
||||
if (pooling && tds.Pooling) {
|
||||
#if NET_2_0
|
||||
if(pool != null) pool.ReleaseConnection (ref tds);
|
||||
#else
|
||||
if(pool != null) pool.ReleaseConnection (tds);
|
||||
#endif
|
||||
}else
|
||||
if(tds != null) tds.Disconnect ();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
2009-01-29 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Tds70.cs: fix for output parameters and '@'.
|
||||
Fixes bug #470579. Patch from Varadhan.
|
||||
|
||||
2009-01-24 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* TdsConnectionPool.cs: made getting/releasing connections thread safe.
|
||||
If we have a release connection available, we return that without locking
|
||||
|
||||
2009-01-21 Christian Hergert <[email protected]>
|
||||
|
||||
* TdsComm.cs: optimize Append(byte[],int,byte) for adding data to
|
||||
the buffer in the largest size of chunks possible. also optimize
|
||||
other Append overloads to use this rather than lots of Append(byte).
|
||||
|
||||
2009-01-20 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* TdsComm.cs: no need for the ManualResetEvent or the timeout instance
|
||||
variables.
|
||||
|
||||
2009-01-14 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Tds70.cs: fix my mistake in the previous patch.
|
||||
|
||||
@@ -541,7 +541,7 @@ namespace Mono.Data.Tds.Protocol
|
||||
parameterName = parameterName.Substring (1);
|
||||
}
|
||||
if (parameter.Direction == TdsParameterDirection.Output)
|
||||
return String.Format ("@{0}={0} output", parameterName);
|
||||
return String.Format ("@{0}=@{0} output", parameterName);
|
||||
if (parameter.Value == null || parameter.Value == DBNull.Value)
|
||||
return String.Format ("@{0}=NULL", parameterName);
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace Mono.Data.Tds.Protocol {
|
||||
|
||||
string dataSource;
|
||||
int commandTimeout;
|
||||
int connectionTimeout;
|
||||
|
||||
byte[] outBuffer;
|
||||
int outBufferLength;
|
||||
@@ -68,8 +67,6 @@ namespace Mono.Data.Tds.Protocol {
|
||||
Socket socket;
|
||||
TdsVersion tdsVersion;
|
||||
|
||||
ManualResetEvent connected = new ManualResetEvent (false);
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
@@ -79,7 +76,6 @@ namespace Mono.Data.Tds.Protocol {
|
||||
this.packetSize = packetSize;
|
||||
this.tdsVersion = tdsVersion;
|
||||
this.dataSource = dataSource;
|
||||
this.connectionTimeout = timeout;
|
||||
|
||||
outBuffer = new byte[packetSize];
|
||||
inBuffer = new byte[packetSize];
|
||||
@@ -90,8 +86,6 @@ namespace Mono.Data.Tds.Protocol {
|
||||
IPEndPoint endPoint;
|
||||
|
||||
try {
|
||||
socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
||||
#if NET_2_0
|
||||
IPAddress ip;
|
||||
if(IPAddress.TryParse(this.dataSource, out ip)) {
|
||||
@@ -104,15 +98,16 @@ namespace Mono.Data.Tds.Protocol {
|
||||
IPHostEntry hostEntry = Dns.Resolve (this.dataSource);
|
||||
endPoint = new IPEndPoint (hostEntry.AddressList [0], port);
|
||||
#endif
|
||||
} catch (SocketException e) {
|
||||
throw new TdsInternalException ("Server does not exist or connection refused.", e);
|
||||
}
|
||||
|
||||
connected.Reset ();
|
||||
socket.BeginConnect (endPoint, new AsyncCallback (ConnectCallback), socket);
|
||||
|
||||
if (timeout > 0 && !connected.WaitOne (new TimeSpan (0, 0, timeout), true))
|
||||
try {
|
||||
socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
IAsyncResult ares = socket.BeginConnect (endPoint, null, null);
|
||||
if (timeout > 0 && !ares.IsCompleted && !ares.AsyncWaitHandle.WaitOne (timeout * 1000, false))
|
||||
throw Tds.CreateTimeoutException (dataSource, "Open()");
|
||||
else if (timeout > 0 && !connected.WaitOne ())
|
||||
throw Tds.CreateTimeoutException (dataSource, "Open()");
|
||||
|
||||
socket.EndConnect (ares);
|
||||
try {
|
||||
// MS sets these socket option
|
||||
socket.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1);
|
||||
@@ -124,8 +119,17 @@ namespace Mono.Data.Tds.Protocol {
|
||||
// Let the stream own the socket and take the pleasure of closing it
|
||||
stream = new NetworkStream (socket, true);
|
||||
} catch (SocketException e) {
|
||||
if (socket != null) {
|
||||
try {
|
||||
Socket s = socket;
|
||||
socket = null;
|
||||
s.Close ();
|
||||
} catch {}
|
||||
}
|
||||
throw new TdsInternalException ("Server does not exist or connection refused.", e);
|
||||
}
|
||||
if (!socket.Connected)
|
||||
throw new TdsInternalException ("Server does not exist or connection refused.", null);
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
@@ -158,6 +162,16 @@ namespace Mono.Data.Tds.Protocol {
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void SendIfFull ()
|
||||
{
|
||||
if (nextOutBufferIndex == outBufferLength) {
|
||||
SendPhysicalPacket (false);
|
||||
nextOutBufferIndex = headerLength;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Append (object o)
|
||||
{
|
||||
if (o == null || o == DBNull.Value) {
|
||||
@@ -208,10 +222,7 @@ namespace Mono.Data.Tds.Protocol {
|
||||
|
||||
public void Append (byte b)
|
||||
{
|
||||
if (nextOutBufferIndex == outBufferLength) {
|
||||
SendPhysicalPacket (false);
|
||||
nextOutBufferIndex = headerLength;
|
||||
}
|
||||
SendIfFull ();
|
||||
Store (nextOutBufferIndex, b);
|
||||
nextOutBufferIndex++;
|
||||
}
|
||||
@@ -241,40 +252,69 @@ namespace Mono.Data.Tds.Protocol {
|
||||
public void Append (byte[] b)
|
||||
{
|
||||
Append (b, b.Length, (byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Append (byte[] b, int len, byte pad)
|
||||
{
|
||||
int i = 0;
|
||||
for ( ; i < b.Length && i < len; i++)
|
||||
Append (b[i]);
|
||||
int bufBytesToCopy = System.Math.Min (b.Length, len);
|
||||
int padBytesToCopy = len - bufBytesToCopy;
|
||||
int bufPos = 0;
|
||||
|
||||
for ( ; i < len; i++)
|
||||
Append (pad);
|
||||
}
|
||||
/* copy out of our input buffer in the largest chunks possible *
|
||||
* at a time. limited only by the buffer size for our outgoing *
|
||||
* packets. */
|
||||
|
||||
while (bufBytesToCopy > 0)
|
||||
{
|
||||
SendIfFull ();
|
||||
|
||||
int availBytes = outBufferLength - nextOutBufferIndex;
|
||||
int bufSize = System.Math.Min (availBytes, bufBytesToCopy);
|
||||
|
||||
Buffer.BlockCopy (b, bufPos, outBuffer, nextOutBufferIndex, bufSize);
|
||||
|
||||
nextOutBufferIndex += bufSize;
|
||||
bufBytesToCopy -= bufSize;
|
||||
bufPos += bufSize;
|
||||
}
|
||||
|
||||
while (padBytesToCopy > 0)
|
||||
{
|
||||
SendIfFull ();
|
||||
|
||||
int availBytes = outBufferLength - nextOutBufferIndex;
|
||||
int bufSize = System.Math.Min (availBytes, padBytesToCopy);
|
||||
|
||||
for (int i = 0; i < bufSize; i++)
|
||||
outBuffer [nextOutBufferIndex++] = pad;
|
||||
|
||||
padBytesToCopy -= bufSize;
|
||||
}
|
||||
}
|
||||
|
||||
public void Append (short s)
|
||||
{
|
||||
if(!BitConverter.IsLittleEndian)
|
||||
Append (Swap (BitConverter.GetBytes(s)));
|
||||
Append (Swap (BitConverter.GetBytes(s)), sizeof(short), (byte)0);
|
||||
else
|
||||
Append (BitConverter.GetBytes (s));
|
||||
Append (BitConverter.GetBytes (s), sizeof(short), (byte)0);
|
||||
}
|
||||
|
||||
public void Append (ushort s)
|
||||
{
|
||||
if(!BitConverter.IsLittleEndian)
|
||||
Append (Swap (BitConverter.GetBytes(s)));
|
||||
Append (Swap (BitConverter.GetBytes(s)), sizeof(short), (byte)0);
|
||||
else
|
||||
Append (BitConverter.GetBytes (s));
|
||||
Append (BitConverter.GetBytes (s), sizeof(short), (byte)0);
|
||||
}
|
||||
|
||||
public void Append (int i)
|
||||
{
|
||||
if(!BitConverter.IsLittleEndian)
|
||||
Append (Swap (BitConverter.GetBytes(i)));
|
||||
Append (Swap (BitConverter.GetBytes(i)), sizeof(int), (byte)0);
|
||||
else
|
||||
Append (BitConverter.GetBytes (i));
|
||||
Append (BitConverter.GetBytes (i), sizeof(int), (byte)0);
|
||||
}
|
||||
|
||||
public void Append (string s)
|
||||
@@ -303,25 +343,25 @@ namespace Mono.Data.Tds.Protocol {
|
||||
public void Append (double value)
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
Append (Swap (BitConverter.GetBytes (value)));
|
||||
Append (Swap (BitConverter.GetBytes (value)), sizeof(double), (byte)0);
|
||||
else
|
||||
Append (BitConverter.GetBytes (value));
|
||||
Append (BitConverter.GetBytes (value), sizeof(double), (byte)0);
|
||||
}
|
||||
|
||||
public void Append (float value)
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
Append (Swap (BitConverter.GetBytes (value)));
|
||||
Append (Swap (BitConverter.GetBytes (value)), sizeof(float), (byte)0);
|
||||
else
|
||||
Append (BitConverter.GetBytes (value));
|
||||
Append (BitConverter.GetBytes (value), sizeof(float), (byte)0);
|
||||
}
|
||||
|
||||
public void Append (long l)
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
Append (Swap (BitConverter.GetBytes (l)));
|
||||
Append (Swap (BitConverter.GetBytes (l)), sizeof(long), (byte)0);
|
||||
else
|
||||
Append (BitConverter.GetBytes (l));
|
||||
Append (BitConverter.GetBytes (l), sizeof(long), (byte)0);
|
||||
}
|
||||
|
||||
public void Append (decimal d, int bytes)
|
||||
@@ -338,23 +378,15 @@ namespace Mono.Data.Tds.Protocol {
|
||||
public void Close ()
|
||||
{
|
||||
connReset = false;
|
||||
socket = null;
|
||||
stream.Close ();
|
||||
}
|
||||
|
||||
public bool IsConnected ()
|
||||
{
|
||||
return !(socket.Poll (0, SelectMode.SelectRead) && socket.Available == 0);
|
||||
return socket != null && socket.Connected && !(socket.Poll (0, SelectMode.SelectRead) && socket.Available == 0);
|
||||
}
|
||||
|
||||
private void ConnectCallback (IAsyncResult ar)
|
||||
{
|
||||
Socket s = (Socket) ar.AsyncState;
|
||||
if (Poll (s, connectionTimeout, SelectMode.SelectWrite)) {
|
||||
socket.EndConnect (ar);
|
||||
connected.Set ();
|
||||
}
|
||||
}
|
||||
|
||||
public byte GetByte ()
|
||||
{
|
||||
byte result;
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
// Author:
|
||||
// Lluis Sanchez Gual ([email protected])
|
||||
// Christian Hergert ([email protected])
|
||||
// Gonzalo Paniagua Javier ([email protected])
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc.
|
||||
//
|
||||
// Copyright (C) 2009 Novell, Inc.
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
@@ -30,22 +31,14 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
#if NET_2_0
|
||||
using System.Collections.Generic;
|
||||
#else
|
||||
using System.Collections;
|
||||
#endif
|
||||
using System.Threading;
|
||||
|
||||
namespace Mono.Data.Tds.Protocol
|
||||
{
|
||||
public class TdsConnectionPoolManager
|
||||
{
|
||||
#if NET_2_0
|
||||
Dictionary <string, TdsConnectionPool> pools = new Dictionary <string, TdsConnectionPool> ();
|
||||
#else
|
||||
Hashtable pools = new Hashtable ();
|
||||
#endif
|
||||
Hashtable pools = Hashtable.Synchronized (new Hashtable ());
|
||||
TdsVersion version;
|
||||
|
||||
public TdsConnectionPoolManager (TdsVersion version)
|
||||
@@ -55,42 +48,19 @@ namespace Mono.Data.Tds.Protocol
|
||||
|
||||
public TdsConnectionPool GetConnectionPool (string connectionString, TdsConnectionInfo info)
|
||||
{
|
||||
lock (pools)
|
||||
{
|
||||
TdsConnectionPool pool = null;
|
||||
#if NET_2_0
|
||||
pools.TryGetValue (connectionString, out pool);
|
||||
#else
|
||||
TdsConnectionPool pool = (TdsConnectionPool) pools [connectionString];
|
||||
if (pool == null) {
|
||||
pools [connectionString] = new TdsConnectionPool (this, info);
|
||||
pool = (TdsConnectionPool) pools [connectionString];
|
||||
#endif
|
||||
if (pool == null) {
|
||||
pool = new TdsConnectionPool (this, info);
|
||||
pools [connectionString] = pool;
|
||||
}
|
||||
return pool;
|
||||
}
|
||||
return pool;
|
||||
}
|
||||
|
||||
public TdsConnectionPool GetConnectionPool (string connectionString)
|
||||
{
|
||||
TdsConnectionPool pool = null;
|
||||
#if NET_2_0
|
||||
pools.TryGetValue (connectionString, out pool);
|
||||
#else
|
||||
pool = (TdsConnectionPool) pools [connectionString];
|
||||
#endif
|
||||
return pool;
|
||||
return (TdsConnectionPool) pools [connectionString];
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public IDictionary <string, TdsConnectionPool> GetConnectionPool ()
|
||||
#else
|
||||
public IDictionary GetConnectionPool ()
|
||||
#endif
|
||||
{
|
||||
return pools;
|
||||
}
|
||||
|
||||
public virtual Tds CreateConnection (TdsConnectionInfo info)
|
||||
{
|
||||
switch (version)
|
||||
@@ -106,6 +76,11 @@ namespace Mono.Data.Tds.Protocol
|
||||
}
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
|
||||
public IDictionary GetConnectionPool ()
|
||||
{
|
||||
return pools;
|
||||
}
|
||||
}
|
||||
|
||||
public class TdsConnectionInfo
|
||||
@@ -130,196 +105,147 @@ namespace Mono.Data.Tds.Protocol
|
||||
|
||||
public class TdsConnectionPool
|
||||
{
|
||||
#if NET_2_0
|
||||
Tds[] list;
|
||||
#else
|
||||
object [] list;
|
||||
#endif
|
||||
|
||||
TdsConnectionInfo info;
|
||||
bool pooling = true;
|
||||
bool no_pooling;
|
||||
TdsConnectionPoolManager manager;
|
||||
ManualResetEvent connAvailable;
|
||||
Queue available;
|
||||
ArrayList conns;
|
||||
object next_free;
|
||||
|
||||
public TdsConnectionPool (TdsConnectionPoolManager manager, TdsConnectionInfo info)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
this.info = info;
|
||||
this.manager = manager;
|
||||
#if NET_2_0
|
||||
list = new Tds[info.PoolMaxSize];
|
||||
#else
|
||||
list = new object [info.PoolMaxSize];
|
||||
#endif
|
||||
conns = new ArrayList (info.PoolMaxSize);
|
||||
available = new Queue (info.PoolMaxSize);
|
||||
InitializePool ();
|
||||
}
|
||||
|
||||
// Placeholder for future connections are at the beginning of the array.
|
||||
for (; n < info.PoolMaxSize - info.PoolMinSize; n++)
|
||||
list [n] = null;
|
||||
|
||||
// Pre-populate with minimum number of connections
|
||||
for (; n < list.Length; n++) {
|
||||
list [n] = CreateConnection ();
|
||||
void InitializePool ()
|
||||
{
|
||||
for (int i = 0; i < info.PoolMinSize; i++) {
|
||||
if (i == 0) {
|
||||
next_free = manager.CreateConnection (info);
|
||||
conns.Add (next_free);
|
||||
} else {
|
||||
Tds t = manager.CreateConnection (info);
|
||||
conns.Add (t);
|
||||
available.Enqueue (t);
|
||||
}
|
||||
}
|
||||
|
||||
// Event that notifies a connection is available in the pool
|
||||
connAvailable = new ManualResetEvent (false);
|
||||
}
|
||||
|
||||
public bool Pooling {
|
||||
get { return pooling; }
|
||||
set { pooling = value; }
|
||||
get { return !no_pooling; }
|
||||
set { no_pooling = !value; }
|
||||
}
|
||||
|
||||
#region Methods
|
||||
|
||||
public Tds GetConnection ()
|
||||
{
|
||||
Tds connection = null;
|
||||
int index;
|
||||
if (no_pooling)
|
||||
return manager.CreateConnection (info);
|
||||
|
||||
retry:
|
||||
// Reset the connection available event
|
||||
connAvailable.Reset ();
|
||||
retry:
|
||||
Tds result = (Tds) Interlocked.Exchange (ref next_free, null);
|
||||
if (result != null && !result.IsConnected)
|
||||
result = null;
|
||||
|
||||
index = list.Length - 1;
|
||||
|
||||
do {
|
||||
#if NET_2_0
|
||||
connection = list [index];
|
||||
#else
|
||||
connection = (Tds) list [index];
|
||||
#endif
|
||||
|
||||
if (connection == null) {
|
||||
// Attempt take-over of array position
|
||||
connection = CreateConnection ();
|
||||
(connection as Tds).poolStatus = 1;
|
||||
|
||||
#if NET_2_0
|
||||
if (Interlocked.CompareExchange<Tds> (ref list [index], connection, null) != null) {
|
||||
#else
|
||||
if (Interlocked.CompareExchange (ref list [index], connection, null) != null) {
|
||||
#endif
|
||||
// Someone beat us to the punch
|
||||
connection = null;
|
||||
while (result == null) {
|
||||
lock (available) {
|
||||
if (available.Count > 0) {
|
||||
result = (Tds) available.Dequeue ();
|
||||
break; // .. and do the reset out of the loop
|
||||
} else {
|
||||
continue;
|
||||
result = (Tds) Interlocked.Exchange (ref next_free, null);
|
||||
if (result != null && result.IsConnected)
|
||||
break;
|
||||
result = null;
|
||||
}
|
||||
} else {
|
||||
if (Interlocked.CompareExchange (ref (connection as Tds).poolStatus, 1, 0) != 0) {
|
||||
// Someone else owns this connection
|
||||
connection = null;
|
||||
} else {
|
||||
if (!connection.Reset ()) {
|
||||
ThreadPool.QueueUserWorkItem (new WaitCallback (DestroyConnection), connection);
|
||||
// remove connection from pool
|
||||
list [index] = connection = null;
|
||||
// allow slot be re-used in same run
|
||||
continue;
|
||||
} else {
|
||||
Monitor.Enter (conns);
|
||||
try {
|
||||
if (conns.Count >= info.PoolMaxSize) {
|
||||
Monitor.Exit (conns);
|
||||
//Console.WriteLine ("GONZ: ENTERING LOCK");
|
||||
bool got_lock = Monitor.Wait (available, info.Timeout * 1000);
|
||||
if (!got_lock) {
|
||||
throw new InvalidOperationException (
|
||||
"Timeout expired. The timeout period elapsed before a " +
|
||||
"connection could be obtained. A possible explanation " +
|
||||
"is that all the connections in the pool are in use, " +
|
||||
"and the maximum pool size is reached.");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
} finally {
|
||||
Monitor.Exit (conns); // Exiting if not owned is ok
|
||||
}
|
||||
}
|
||||
|
||||
index--;
|
||||
|
||||
if (index < 0) {
|
||||
// TODO: Maintain a list of indices of released connection to save some loop over
|
||||
// Honor timeout - if pool is full, and no connections are available within the
|
||||
// timeout period - just throw the exception
|
||||
if (info.Timeout > 0
|
||||
&& !connAvailable.WaitOne (new TimeSpan (0, 0, info.Timeout), true))
|
||||
throw new InvalidOperationException (
|
||||
"Timeout expired. The timeout period elapsed before a " +
|
||||
"connection could be obtained. A possible explanation " +
|
||||
"is that all the connections in the pool are in use, " +
|
||||
"and the maximum pool size is reached.");
|
||||
goto retry;
|
||||
lock (conns) {
|
||||
if (conns.Count < info.PoolMaxSize) {
|
||||
try {
|
||||
//Console.WriteLine ("GONZ: NEW");
|
||||
result = manager.CreateConnection (info);
|
||||
conns.Add (result);
|
||||
return result; // no reset needed
|
||||
} catch {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while (connection == null);
|
||||
|
||||
return connection;
|
||||
if (!result.IsConnected || !result.Reset ()) {
|
||||
//Console.WriteLine ("GONZ: RESET FAILED");
|
||||
lock (conns)
|
||||
conns.Remove (result);
|
||||
ThreadPool.QueueUserWorkItem (new WaitCallback (DestroyConnection), result);
|
||||
goto retry;
|
||||
}
|
||||
//Console.WriteLine ("GONZ: REUSED");
|
||||
return result;
|
||||
}
|
||||
|
||||
public void ReleaseConnection (Tds connection)
|
||||
{
|
||||
connection.poolStatus = 0;
|
||||
connAvailable.Set ();
|
||||
if (no_pooling) {
|
||||
ThreadPool.QueueUserWorkItem (new WaitCallback (DestroyConnection), connection);
|
||||
return;
|
||||
}
|
||||
lock (available) {
|
||||
if (Interlocked.CompareExchange (ref next_free, connection, null) != null)
|
||||
available.Enqueue (connection);
|
||||
Monitor.Pulse (available);
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public void ReleaseConnection (ref Tds connection)
|
||||
{
|
||||
if (pooling == false) {
|
||||
int index = Array.IndexOf (list, connection);
|
||||
ThreadPool.QueueUserWorkItem (new WaitCallback (DestroyConnection), connection);
|
||||
list [index] = connection = null;
|
||||
} else {
|
||||
connection.poolStatus = 0;
|
||||
}
|
||||
connAvailable.Set ();
|
||||
}
|
||||
|
||||
public void ResetConnectionPool ()
|
||||
{
|
||||
Tds connection = null;
|
||||
int index = list.Length - 1;
|
||||
|
||||
while (index >= 0)
|
||||
{
|
||||
connection = list [index];
|
||||
|
||||
// skip free slots
|
||||
if (connection == null) {
|
||||
index--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Interlocked.CompareExchange (ref connection.poolStatus, 1, 0) == 0)
|
||||
ThreadPool.QueueUserWorkItem (new WaitCallback (DestroyConnection), connection);
|
||||
connection.Pooling = false;
|
||||
|
||||
list [index] = connection = null;
|
||||
connAvailable.Set ();
|
||||
|
||||
index--;
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetConnectionPool (Tds connection)
|
||||
{
|
||||
int index = Array.IndexOf (list, connection);
|
||||
|
||||
if (index != -1) {
|
||||
if (connection != null && !connection.Reset ()) {
|
||||
ThreadPool.QueueUserWorkItem (new WaitCallback (DestroyConnection), connection);
|
||||
list [index] = connection = null;
|
||||
connAvailable.Set ();
|
||||
lock (available) {
|
||||
available.Clear ();
|
||||
lock (conns) {
|
||||
for (int i = 0; i < conns.Count; i++) {
|
||||
Tds tds = (Tds) conns [i];
|
||||
ThreadPool.QueueUserWorkItem (new WaitCallback (DestroyConnection), tds);
|
||||
}
|
||||
conns.Clear ();
|
||||
InitializePool ();
|
||||
Monitor.PulseAll (available);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Tds CreateConnection ()
|
||||
{
|
||||
return manager.CreateConnection (info);
|
||||
}
|
||||
|
||||
void DestroyConnection (object state)
|
||||
static void DestroyConnection (object state)
|
||||
{
|
||||
Tds connection = state as Tds;
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.Disconnect ();
|
||||
} finally {
|
||||
connection = null;
|
||||
}
|
||||
connection.Disconnect ();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-02-20 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* TdsDataReader.cs: Access TdsDataColumn correctly for NET_2_0.
|
||||
Fixes #466199. Patch by Tom Hindle <[email protected]>
|
||||
|
||||
2008-07-06 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* Mono.Data.TdsClient/TdsCommand.cs: Fix unneeded assignment
|
||||
|
||||
@@ -389,7 +389,11 @@ namespace Mono.Data.TdsClient {
|
||||
if (row ["BaseColumnName"] == DBNull.Value)
|
||||
row ["BaseColumnName"] = row ["ColumnName"];
|
||||
|
||||
#if NET_2_0
|
||||
switch ((TdsColumnType) schema.ColumnType) {
|
||||
#else
|
||||
switch ((TdsColumnType) schema ["ColumnType"]) {
|
||||
#endif
|
||||
case TdsColumnType.Image :
|
||||
dataTypeNames.Add ("image");
|
||||
row ["ProviderType"] = (int) TdsType.Image;
|
||||
|
||||
@@ -2,6 +2,7 @@ System/TimeZoneInfoTest.cs
|
||||
System/TimeZoneInfo.AdjustmentRuleTest.cs
|
||||
System/TimeZoneInfo.TransitionTimeTest.cs
|
||||
System.Collections.Generic/HashSetTest.cs
|
||||
System.Linq/EnumerableFixture.cs
|
||||
System.Linq/EnumerableTest.cs
|
||||
System.Linq/EnumerableMoreTest.cs
|
||||
System.Linq/EnumerableAsQueryableTest.cs
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
2009-02-24 Jb Evain <[email protected]>
|
||||
|
||||
backport of 127871.
|
||||
|
||||
* Expression.cs (BinaryCoreCheck): fix comparison of enums.
|
||||
|
||||
2009-02-23 Jb Evain <[email protected]>
|
||||
|
||||
backport of 127755.
|
||||
|
||||
* Expression.cs (IsNumber): actually decimal is rather a special
|
||||
case, and not a primitive number.
|
||||
|
||||
2009-02-23 Jb Evain <[email protected]>
|
||||
|
||||
backport of 127746.
|
||||
|
||||
* Expression.cs (BinaryCoreCheck): add decimal operations
|
||||
are provided by custom operators.
|
||||
|
||||
2008-12-17 Jb Evain <[email protected]>
|
||||
|
||||
* ExpressionTransformer.cs: fix VisitList.
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace System.Linq.Expressions {
|
||||
}
|
||||
|
||||
// Use IsNumber to avoid expensive reflection.
|
||||
if (IsNumber (ultype)){
|
||||
if (IsNumber (ultype)) {
|
||||
if (ultype == urtype && ltype == rtype)
|
||||
return null;
|
||||
|
||||
@@ -265,6 +265,9 @@ namespace System.Linq.Expressions {
|
||||
if (!ltype.IsValueType && !rtype.IsValueType)
|
||||
return null;
|
||||
|
||||
if (ltype == rtype && ultype.IsEnum)
|
||||
return null;
|
||||
|
||||
if (ltype == rtype && ultype == typeof (bool))
|
||||
return null;
|
||||
}
|
||||
@@ -2221,7 +2224,7 @@ namespace System.Linq.Expressions {
|
||||
if (IsInt (t))
|
||||
return true;
|
||||
|
||||
return t == typeof (float) || t == typeof (double) || t == typeof (decimal);
|
||||
return t == typeof (float) || t == typeof (double);
|
||||
}
|
||||
|
||||
static bool IsSignedNumber (Type t)
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
2009-02-23 Jb Evain <[email protected]>
|
||||
|
||||
backport of 127772.
|
||||
|
||||
* Enumerable.cs (IterateNullable): fix initial value
|
||||
for nullables.
|
||||
|
||||
2009-01-22 Jb Evain <[email protected]>
|
||||
|
||||
* SortSequenceContext.cs: make sort stable.
|
||||
|
||||
2009-01-22 Jb Evain <[email protected]>
|
||||
|
||||
* Enumerable.cs (Sum): check the sum operations for possible overfows.
|
||||
|
||||
2009-01-22 Jb Evain <[email protected]>
|
||||
|
||||
* Enumerable.cs (SequenceEqual): make sure we dispose enumerators.
|
||||
|
||||
2009-01-22 Jb Evain <[email protected]>
|
||||
|
||||
* Enumerable.cs: optimize Last for lists.
|
||||
|
||||
2009-01-15 Jb Evain <[email protected]>
|
||||
|
||||
* Lookup.cs: propage the appropriate comparer for the lookup.
|
||||
|
||||
@@ -935,6 +935,14 @@ namespace System.Linq
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
var collection = source as ICollection<TSource>;
|
||||
if (collection != null && collection.Count == 0)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
var list = source as IList<TSource>;
|
||||
if (list != null)
|
||||
return list [list.Count - 1];
|
||||
|
||||
return source.Last (PredicateOf<TSource>.Always, Fallback.Throw);
|
||||
}
|
||||
|
||||
@@ -1044,46 +1052,48 @@ namespace System.Linq
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, int.MinValue, (a, b) => a > b);
|
||||
return IterateNullable (source, (a, b) => a > b);
|
||||
}
|
||||
|
||||
public static long? Max (this IEnumerable<long?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, long.MinValue, (a, b) => a > b);
|
||||
return IterateNullable (source, (a, b) => a > b);
|
||||
}
|
||||
|
||||
public static double? Max (this IEnumerable<double?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, double.MinValue, (a, b) => a > b);
|
||||
return IterateNullable (source, (a, b) => a > b);
|
||||
}
|
||||
|
||||
public static float? Max (this IEnumerable<float?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, float.MinValue, (a, b) => a > b);
|
||||
return IterateNullable (source, (a, b) => a > b);
|
||||
}
|
||||
|
||||
public static decimal? Max (this IEnumerable<decimal?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, decimal.MinValue, (a, b) => a > b);
|
||||
return IterateNullable (source, (a, b) => a > b);
|
||||
}
|
||||
|
||||
static T? IterateNullable<T> (IEnumerable<T?> source, T initValue, Func<T?, T?, bool> selector) where T : struct
|
||||
static T? IterateNullable<T> (IEnumerable<T?> source, Func<T?, T?, bool> selector) where T : struct
|
||||
{
|
||||
bool empty = true;
|
||||
T? value = initValue;
|
||||
T? value = null;
|
||||
foreach (var element in source) {
|
||||
if (!element.HasValue)
|
||||
continue;
|
||||
|
||||
if (selector (element.Value, value))
|
||||
if (!value.HasValue)
|
||||
value = element.Value;
|
||||
else if (selector (element.Value, value))
|
||||
value = element;
|
||||
|
||||
empty = false;
|
||||
@@ -1095,6 +1105,30 @@ namespace System.Linq
|
||||
return value;
|
||||
}
|
||||
|
||||
static TRet? IterateNullable<TSource, TRet> (
|
||||
IEnumerable<TSource> source,
|
||||
Func<TSource, TRet?> source_selector,
|
||||
Func<TRet?, TRet?, bool> selector) where TRet : struct
|
||||
{
|
||||
bool empty = true;
|
||||
TRet? value = null;
|
||||
foreach (var element in source) {
|
||||
TRet? item = source_selector (element);
|
||||
|
||||
if (!value.HasValue)
|
||||
value = item;
|
||||
else if (selector (item, value))
|
||||
value = item;
|
||||
|
||||
empty = false;
|
||||
}
|
||||
|
||||
if (empty)
|
||||
return null;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static TSource Max<TSource> (this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
@@ -1176,67 +1210,39 @@ namespace System.Linq
|
||||
return initValue;
|
||||
}
|
||||
|
||||
static U? IterateNullable<T, U> (IEnumerable<T> source, U initialValue, Func<T, U?, U?> selector) where U : struct
|
||||
{
|
||||
bool empty = true;
|
||||
U? value = initialValue;
|
||||
foreach (var element in source) {
|
||||
value = selector (element, value);
|
||||
if (!value.HasValue)
|
||||
continue;
|
||||
|
||||
empty = false;
|
||||
}
|
||||
|
||||
if (empty)
|
||||
return null;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static int? Max<TSource> (this IEnumerable<TSource> source, Func<TSource, int?> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, int.MinValue, (a, b) => {
|
||||
var v = selector (a); return v > b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a > b);
|
||||
}
|
||||
|
||||
public static long? Max<TSource> (this IEnumerable<TSource> source, Func<TSource, long?> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, long.MinValue, (a, b) => {
|
||||
var v = selector (a); return v > b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a > b);
|
||||
}
|
||||
|
||||
public static double? Max<TSource> (this IEnumerable<TSource> source, Func<TSource, double?> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, double.MinValue, (a, b) => {
|
||||
var v = selector (a); return v > b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a > b);
|
||||
}
|
||||
|
||||
public static float? Max<TSource> (this IEnumerable<TSource> source, Func<TSource, float?> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, float.MinValue, (a, b) => {
|
||||
var v = selector (a); return v > b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a > b);
|
||||
}
|
||||
|
||||
public static decimal? Max<TSource> (this IEnumerable<TSource> source, Func<TSource, decimal?> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, decimal.MinValue, (a, b) => {
|
||||
var v = selector (a); return v > b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a > b);
|
||||
}
|
||||
|
||||
public static TResult Max<TSource, TResult> (this IEnumerable<TSource> source, Func<TSource, TResult> selector)
|
||||
@@ -1315,35 +1321,35 @@ namespace System.Linq
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, int.MaxValue, (a, b) => a < b);
|
||||
return IterateNullable (source, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static long? Min (this IEnumerable<long?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, long.MaxValue, (a, b) => a < b);
|
||||
return IterateNullable (source, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static double? Min (this IEnumerable<double?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, double.MaxValue, (a, b) => a < b);
|
||||
return IterateNullable (source, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static float? Min (this IEnumerable<float?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, float.MaxValue, (a, b) => a < b);
|
||||
return IterateNullable (source, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static decimal? Min (this IEnumerable<decimal?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return IterateNullable (source, decimal.MaxValue, (a, b) => a < b);
|
||||
return IterateNullable (source, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static TSource Min<TSource> (this IEnumerable<TSource> source)
|
||||
@@ -1417,45 +1423,35 @@ namespace System.Linq
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, int.MaxValue, (a, b) => {
|
||||
var v = selector (a); return v < b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static long? Min<TSource> (this IEnumerable<TSource> source, Func<TSource, long?> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, long.MaxValue, (a, b) => {
|
||||
var v = selector (a); return v < b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static float? Min<TSource> (this IEnumerable<TSource> source, Func<TSource, float?> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, float.MaxValue, (a, b) => {
|
||||
var v = selector (a); return v < b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static double? Min<TSource> (this IEnumerable<TSource> source, Func<TSource, double?> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, double.MaxValue, (a, b) => {
|
||||
var v = selector (a); return v < b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static decimal? Min<TSource> (this IEnumerable<TSource> source, Func<TSource, decimal?> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return IterateNullable (source, decimal.MaxValue, (a, b) => {
|
||||
var v = selector (a); return v < b ? v : b;
|
||||
});
|
||||
return IterateNullable (source, selector, (a, b) => a < b);
|
||||
}
|
||||
|
||||
public static TResult Min<TSource, TResult> (this IEnumerable<TSource> source, Func<TSource, TResult> selector)
|
||||
@@ -1847,21 +1843,21 @@ namespace System.Linq
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return Sum<int, int> (source, (a, b) => a + b);
|
||||
return Sum<int, int> (source, (a, b) => checked (a + b));
|
||||
}
|
||||
|
||||
public static int? Sum (this IEnumerable<int?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return source.SumNullable<int?, int?> (0, (a, b) => a.HasValue ? a + b : a);
|
||||
return source.SumNullable<int?, int?> (0, (total, element) => element.HasValue ? checked (total + element) : total);
|
||||
}
|
||||
|
||||
public static int Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, int> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return Sum<TSource, int> (source, (a, b) => a + selector (b));
|
||||
return Sum<TSource, int> (source, (a, b) => checked (a + selector (b)));
|
||||
}
|
||||
|
||||
public static int? Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, int?> selector)
|
||||
@@ -1870,7 +1866,7 @@ namespace System.Linq
|
||||
|
||||
return source.SumNullable<TSource, int?> (0, (a, b) => {
|
||||
var value = selector (b);
|
||||
return value.HasValue ? a + value.Value : a;
|
||||
return value.HasValue ? checked (a + value.Value) : a;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1878,21 +1874,21 @@ namespace System.Linq
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return Sum<long, long> (source, (a, b) => a + b);
|
||||
return Sum<long, long> (source, (a, b) => checked (a + b));
|
||||
}
|
||||
|
||||
public static long? Sum (this IEnumerable<long?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return source.SumNullable<long?, long?> (0, (a, b) => a.HasValue ? a + b : a);
|
||||
return source.SumNullable<long?, long?> (0, (total, element) => element.HasValue ? checked (total + element) : total);
|
||||
}
|
||||
|
||||
public static long Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, long> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return Sum<TSource, long> (source, (a, b) => a + selector (b));
|
||||
return Sum<TSource, long> (source, (a, b) => checked (a + selector (b)));
|
||||
}
|
||||
|
||||
public static long? Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, long?> selector)
|
||||
@@ -1901,7 +1897,7 @@ namespace System.Linq
|
||||
|
||||
return source.SumNullable<TSource, long?> (0, (a, b) => {
|
||||
var value = selector (b);
|
||||
return value.HasValue ? a + value.Value : a;
|
||||
return value.HasValue ? checked (a + value.Value) : a;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1909,21 +1905,21 @@ namespace System.Linq
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return Sum<double, double> (source, (a, b) => a + b);
|
||||
return Sum<double, double> (source, (a, b) => checked (a + b));
|
||||
}
|
||||
|
||||
public static double? Sum (this IEnumerable<double?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return source.SumNullable<double?, double?> (0, (a, b) => a.HasValue ? a + b : a);
|
||||
return source.SumNullable<double?, double?> (0, (total, element) => element.HasValue ? checked (total + element) : total);
|
||||
}
|
||||
|
||||
public static double Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, double> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return Sum<TSource, double> (source, (a, b) => a + selector (b));
|
||||
return Sum<TSource, double> (source, (a, b) => checked (a + selector (b)));
|
||||
}
|
||||
|
||||
public static double? Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, double?> selector)
|
||||
@@ -1932,7 +1928,7 @@ namespace System.Linq
|
||||
|
||||
return source.SumNullable<TSource, double?> (0, (a, b) => {
|
||||
var value = selector (b);
|
||||
return value.HasValue ? a + value.Value : a;
|
||||
return value.HasValue ? checked (a + value.Value) : a;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1940,21 +1936,21 @@ namespace System.Linq
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return Sum<float, float> (source, (a, b) => a + b);
|
||||
return Sum<float, float> (source, (a, b) => checked (a + b));
|
||||
}
|
||||
|
||||
public static float? Sum (this IEnumerable<float?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return source.SumNullable<float?, float?> (0, (a, b) => a.HasValue ? a + b : a);
|
||||
return source.SumNullable<float?, float?> (0, (total, element) => element.HasValue ? checked (total + element) : total);
|
||||
}
|
||||
|
||||
public static float Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, float> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return Sum<TSource, float> (source, (a, b) => a + selector (b));
|
||||
return Sum<TSource, float> (source, (a, b) => checked (a + selector (b)));
|
||||
}
|
||||
|
||||
public static float? Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, float?> selector)
|
||||
@@ -1963,7 +1959,7 @@ namespace System.Linq
|
||||
|
||||
return source.SumNullable<TSource, float?> (0, (a, b) => {
|
||||
var value = selector (b);
|
||||
return value.HasValue ? a + value.Value : a;
|
||||
return value.HasValue ? checked (a + value.Value) : a;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1971,21 +1967,21 @@ namespace System.Linq
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return Sum<decimal, decimal> (source, (a, b) => a + b);
|
||||
return Sum<decimal, decimal> (source, (a, b) => checked (a + b));
|
||||
}
|
||||
|
||||
public static decimal? Sum (this IEnumerable<decimal?> source)
|
||||
{
|
||||
Check.Source (source);
|
||||
|
||||
return source.SumNullable<decimal?, decimal?> (0, (a, b) => a.HasValue ? a + b : a);
|
||||
return source.SumNullable<decimal?, decimal?> (0, (total, element) => element.HasValue ? checked (total + element) : total);
|
||||
}
|
||||
|
||||
public static decimal Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, decimal> selector)
|
||||
{
|
||||
Check.SourceAndSelector (source, selector);
|
||||
|
||||
return Sum<TSource, decimal> (source, (a, b) => a + selector (b));
|
||||
return Sum<TSource, decimal> (source, (a, b) => checked (a + selector (b)));
|
||||
}
|
||||
|
||||
public static decimal? Sum<TSource> (this IEnumerable<TSource> source, Func<TSource, decimal?> selector)
|
||||
@@ -1994,7 +1990,7 @@ namespace System.Linq
|
||||
|
||||
return source.SumNullable<TSource, decimal?> (0, (a, b) => {
|
||||
var value = selector (b);
|
||||
return value.HasValue ? a + value.Value : a;
|
||||
return value.HasValue ? checked (a + value.Value) : a;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2243,18 +2239,19 @@ namespace System.Linq
|
||||
if (comparer == null)
|
||||
comparer = EqualityComparer<TSource>.Default;
|
||||
|
||||
var first_enumerator = first.GetEnumerator ();
|
||||
var second_enumerator = second.GetEnumerator ();
|
||||
using (IEnumerator<TSource> first_enumerator = first.GetEnumerator (),
|
||||
second_enumerator = second.GetEnumerator ()) {
|
||||
|
||||
while (first_enumerator.MoveNext ()) {
|
||||
if (!second_enumerator.MoveNext ())
|
||||
return false;
|
||||
while (first_enumerator.MoveNext ()) {
|
||||
if (!second_enumerator.MoveNext ())
|
||||
return false;
|
||||
|
||||
if (!comparer.Equals (first_enumerator.Current, second_enumerator.Current))
|
||||
return false;
|
||||
if (!comparer.Equals (first_enumerator.Current, second_enumerator.Current))
|
||||
return false;
|
||||
}
|
||||
|
||||
return !second_enumerator.MoveNext ();
|
||||
}
|
||||
|
||||
return !second_enumerator.MoveNext ();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -59,8 +59,12 @@ namespace System.Linq {
|
||||
{
|
||||
int comparison = comparer.Compare (keys [first_index], keys [second_index]);
|
||||
|
||||
if (comparison == 0 && child_context != null)
|
||||
return child_context.Compare (first_index, second_index);
|
||||
if (comparison == 0) {
|
||||
if (child_context != null)
|
||||
return child_context.Compare (first_index, second_index);
|
||||
else
|
||||
comparison = first_index - second_index;
|
||||
}
|
||||
|
||||
return direction == SortDirection.Descending ? -comparison : comparison;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F902A50D-6156-4935-A1AC-E82DF0EB83D3}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
@@ -105,6 +105,7 @@
|
||||
<Compile Include="System.Linq.Expressions\ExpressionTest_UnaryPlus.cs" />
|
||||
<Compile Include="System.Linq.Expressions\ExpressionTest_Utils.cs" />
|
||||
<Compile Include="System.Linq\EnumerableAsQueryableTest.cs" />
|
||||
<Compile Include="System.Linq\EnumerableFixture.cs" />
|
||||
<Compile Include="System.Linq\EnumerableMoreTest.cs" />
|
||||
<Compile Include="System.Linq\EnumerableTest.cs" />
|
||||
<Compile Include="System.Linq\LookupTest.cs" />
|
||||
@@ -129,4 +130,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,3 +1,13 @@
|
||||
2009-02-23 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* OracleException: 2.0 changes - patch submitted by
|
||||
Jay Wren <[email protected]>
|
||||
|
||||
2009-02-19 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* OracleParameter.cs (bind): Consider OciDataType.Float and .Integer as
|
||||
OciDataType.Number. Patch provided by Russell <[email protected]>
|
||||
|
||||
2008-07-06 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* OracleDataReader.cs: Replace a few Type.GetType by typeof
|
||||
|
||||
@@ -21,7 +21,12 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
[Serializable]
|
||||
public sealed class OracleException : SystemException
|
||||
public sealed class OracleException
|
||||
#if NET_2_0
|
||||
: System.Data.Common.DbException
|
||||
#else
|
||||
: SystemException
|
||||
#endif // NET_1_1
|
||||
{
|
||||
#region Fields
|
||||
|
||||
|
||||
@@ -550,6 +550,8 @@ namespace System.Data.OracleClient
|
||||
timezone);
|
||||
}
|
||||
break;
|
||||
case OciDataType.Integer:
|
||||
case OciDataType.Float:
|
||||
case OciDataType.Number:
|
||||
bindType = OciDataType.String;
|
||||
indicator = 0;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-02-20 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* OdbcDataReader.cs (GetValue): Handle null image data. Fixes ##419224
|
||||
Patch by John Mortlock <[email protected]>.
|
||||
|
||||
2009-01-18 Gert Driesen <[email protected]>
|
||||
|
||||
* OdbcDataReader.cs: Fixed GetBytes with limited length. Added reader
|
||||
|
||||
@@ -808,21 +808,25 @@ namespace System.Data.Odbc
|
||||
bufsize = (col.MaxLength < 255 && col.MaxLength > 0 ? col.MaxLength : 255);
|
||||
buffer= new byte [bufsize];
|
||||
ArrayList al = new ArrayList ();
|
||||
do {
|
||||
ret = libodbc.SQLGetData (hstmt, ColIndex, SQL_C_TYPE.BINARY, buffer, bufsize, ref outsize);
|
||||
if (ret == OdbcReturn.Error)
|
||||
break;
|
||||
if (ret != OdbcReturn.NoData && outsize != -1) {
|
||||
if (outsize < bufsize) {
|
||||
byte [] tmparr = new byte [outsize];
|
||||
Array.Copy (buffer, 0, tmparr, 0, outsize);
|
||||
al.AddRange (tmparr);
|
||||
} else
|
||||
al.AddRange (buffer);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (ret != OdbcReturn.NoData);
|
||||
//get the size of data to be returned.
|
||||
ret = libodbc.SQLGetData (hstmt, ColIndex, SQL_C_TYPE.BINARY, buffer, 0, ref outsize);
|
||||
if (outsize != (int) OdbcLengthIndicator.NullData) {
|
||||
do {
|
||||
ret = libodbc.SQLGetData (hstmt, ColIndex, SQL_C_TYPE.BINARY, buffer, bufsize, ref outsize);
|
||||
if (ret == OdbcReturn.Error)
|
||||
break;
|
||||
if (ret != OdbcReturn.NoData && outsize != -1) {
|
||||
if (outsize < bufsize) {
|
||||
byte [] tmparr = new byte [outsize];
|
||||
Array.Copy (buffer, 0, tmparr, 0, outsize);
|
||||
al.AddRange (tmparr);
|
||||
} else
|
||||
al.AddRange (buffer);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (ret != OdbcReturn.NoData);
|
||||
}
|
||||
DataValue = al.ToArray (typeof (byte));
|
||||
break;
|
||||
case OdbcType.Binary :
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-02-19 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* OleDbFactory.cs: New file.
|
||||
|
||||
2008-04-21 Gert Driesen <[email protected]>
|
||||
|
||||
* OleDbDataAdapter.cs: Changed argument names to match MS. Removed
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// System.Data.oleDb.OleDbFactory
|
||||
//
|
||||
// Author:
|
||||
// Gonzalo Paniagua ([email protected])
|
||||
//
|
||||
// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#if NET_2_0
|
||||
using System.Data.Common;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace System.Data.OleDb {
|
||||
public sealed class OleDbFactory : DbProviderFactory {
|
||||
public static readonly OleDbFactory Instance = new OleDbFactory ();
|
||||
|
||||
private OleDbFactory()
|
||||
{
|
||||
}
|
||||
|
||||
public override DbCommand CreateCommand ()
|
||||
{
|
||||
return new OleDbCommand ();
|
||||
}
|
||||
|
||||
public override DbCommandBuilder CreateCommandBuilder ()
|
||||
{
|
||||
return new OleDbCommandBuilder ();
|
||||
}
|
||||
|
||||
public override DbConnection CreateConnection ()
|
||||
{
|
||||
return new OleDbConnection ();
|
||||
}
|
||||
|
||||
public override DbConnectionStringBuilder CreateConnectionStringBuilder ()
|
||||
{
|
||||
//TODO: Once we have an OleDbConnectionStringBuilder implementation, comment the next line out
|
||||
//return new OleDbConnectionStringBuilder ();
|
||||
return null;
|
||||
}
|
||||
|
||||
public override DbDataAdapter CreateDataAdapter ()
|
||||
{
|
||||
return new OleDbDataAdapter ();
|
||||
}
|
||||
|
||||
public override DbParameter CreateParameter ()
|
||||
{
|
||||
return new OleDbParameter ();
|
||||
}
|
||||
|
||||
public override CodeAccessPermission CreatePermission (PermissionState state)
|
||||
{
|
||||
return new OleDbPermission (state);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-01-24 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* SqlConnection.cs: adapt to changes in TdsConnectionPool.
|
||||
Don't Close() on every error.
|
||||
|
||||
2009-01-17 Gert Driesen <[email protected]>
|
||||
|
||||
* SqlParameter.cs: Renamed isDirty to typeChanged; it is now now only
|
||||
|
||||
@@ -302,10 +302,6 @@ namespace System.Data.SqlClient
|
||||
|
||||
private void ErrorHandler (object sender, TdsInternalErrorMessageEventArgs e)
|
||||
{
|
||||
try {
|
||||
Close ();
|
||||
} catch {
|
||||
}
|
||||
throw new SqlException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SqlClient Data Provider", e.State);
|
||||
}
|
||||
|
||||
@@ -428,15 +424,12 @@ namespace System.Data.SqlClient
|
||||
if (tds != null && tds.IsConnected) {
|
||||
if (pooling && tds.Pooling) {
|
||||
if (pool != null) {
|
||||
#if NET_2_0
|
||||
pool.ReleaseConnection (ref tds);
|
||||
#else
|
||||
pool.ReleaseConnection (tds);
|
||||
#endif
|
||||
pool = null;
|
||||
}
|
||||
}else
|
||||
if(tds != null) tds.Disconnect ();
|
||||
} else {
|
||||
tds.Disconnect ();
|
||||
}
|
||||
}
|
||||
|
||||
if (tds != null) {
|
||||
@@ -1693,15 +1686,13 @@ namespace System.Data.SqlClient
|
||||
|
||||
public static void ClearAllPools ()
|
||||
{
|
||||
#if NET_2_0
|
||||
IDictionary <string, TdsConnectionPool> pools = SqlConnection.sqlConnectionPools.GetConnectionPool ();
|
||||
#else
|
||||
Hashtable pools = SqlConnection.sqlConnectionPools.GetConnectionPool ();
|
||||
#endif
|
||||
// FIXME: locking
|
||||
IDictionary pools = SqlConnection.sqlConnectionPools.GetConnectionPool ();
|
||||
foreach (TdsConnectionPool pool in pools.Values) {
|
||||
if (pool != null)
|
||||
pool.ResetConnectionPool ();
|
||||
}
|
||||
pools.Clear ();
|
||||
}
|
||||
|
||||
public static void ClearPool (SqlConnection connection)
|
||||
@@ -1709,9 +1700,9 @@ namespace System.Data.SqlClient
|
||||
if (connection == null)
|
||||
throw new ArgumentNullException ("connection");
|
||||
|
||||
// FIXME: locking
|
||||
if (connection.pooling) {
|
||||
TdsConnectionPool pool = sqlConnectionPools.GetConnectionPool (
|
||||
connection.ConnectionString);
|
||||
TdsConnectionPool pool = sqlConnectionPools.GetConnectionPool (connection.ConnectionString);
|
||||
if (pool != null)
|
||||
pool.ResetConnectionPool ();
|
||||
}
|
||||
|
||||
@@ -185,6 +185,7 @@ System.Data.OleDb/OleDbDataReader.cs
|
||||
System.Data.OleDb/OleDbError.cs
|
||||
System.Data.OleDb/OleDbErrorCollection.cs
|
||||
System.Data.OleDb/OleDbException.cs
|
||||
System.Data.OleDb/OleDbFactory.cs
|
||||
System.Data.OleDb/OleDbInfoMessageEventArgs.cs
|
||||
System.Data.OleDb/OleDbInfoMessageEventHandler.cs
|
||||
System.Data.OleDb/OleDbLiteral.cs
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
2009-02-24 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* *Fixes #377146 - in a better way
|
||||
* XmlDataReader.cs (ReadElementElement): For reference types that
|
||||
implement IXmlSerializable, call the corresponding ReadXml.
|
||||
* DataSet.cs (WriteColumnAsElement): For reference types that implement
|
||||
IXmlSerializable, call the corresponding WriteXml.
|
||||
|
||||
2009-02-24 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* Fixes #476523
|
||||
* DbType.cs: Add DateTime2 and DateTimeOffset - 3.5 additions
|
||||
Patch by Jay Wren <[email protected]>
|
||||
|
||||
2009-01-05 Raja R Harinath <[email protected]>
|
||||
|
||||
* DataRelationCollection.cs (BinarySerialize): New. Carved out of ...
|
||||
|
||||
@@ -1274,6 +1274,7 @@ namespace System.Data
|
||||
if (o is TimeSpan) return XmlConvert.ToString ((TimeSpan) o);
|
||||
if (o is Guid) return XmlConvert.ToString ((Guid) o);
|
||||
if (o is byte[]) return Convert.ToBase64String ((byte[])o);
|
||||
|
||||
return o.ToString ();
|
||||
}
|
||||
|
||||
@@ -1384,8 +1385,13 @@ namespace System.Data
|
||||
colnspc = col.Namespace;
|
||||
|
||||
//TODO check if I can get away with write element string
|
||||
WriteStartElement (writer, mode, colnspc, col.Prefix, XmlHelper.Encode (col.ColumnName));
|
||||
writer.WriteString (WriteObjectXml (rowObject));
|
||||
WriteStartElement (writer, mode, colnspc, col.Prefix, XmlHelper.Encode (col.ColumnName));
|
||||
if (typeof (IXmlSerializable).IsAssignableFrom (col.DataType)) {
|
||||
((IXmlSerializable)rowObject).WriteXml (writer);
|
||||
} else {
|
||||
writer.WriteString (WriteObjectXml (rowObject));
|
||||
}
|
||||
|
||||
writer.WriteEndElement ();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ namespace System.Data
|
||||
AnsiStringFixedLength = 22,
|
||||
#if NET_2_0
|
||||
Xml = 25,
|
||||
DateTime2 = 26,
|
||||
DateTimeOffset = 27,
|
||||
#endif
|
||||
StringFixedLength = 23
|
||||
}
|
||||
|
||||
@@ -305,13 +305,23 @@ namespace System.Data
|
||||
// however doesn't behave well with XMLs like the one in
|
||||
// https://bugzilla.novell.com/show_bug.cgi?id=377146 which is
|
||||
// apparently supported by MS.NET - to maintain compatibility,
|
||||
// Try reading the element content as an object type
|
||||
row [col] = reader.ReadContentAsObject ();
|
||||
} catch {
|
||||
// If the obj implements IXmlSerializable, let obj's ReadXml do the reading
|
||||
IXmlSerializable obj = (IXmlSerializable) Activator.CreateInstance (col.DataType, new object [0]);
|
||||
if (!reader.IsEmptyElement) {
|
||||
obj.ReadXml (reader);
|
||||
reader.ReadEndElement ();
|
||||
} else {
|
||||
reader.Skip ();
|
||||
}
|
||||
row [col] = obj;
|
||||
} catch (XmlException e) {
|
||||
#endif
|
||||
// XML is not in accordance to expected standards, try reading the content as an xml doc
|
||||
row [col] = reader.ReadInnerXml ();
|
||||
#if NET_2_0
|
||||
} catch (InvalidOperationException e) {
|
||||
|
||||
row [col] = reader.ReadInnerXml ();
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-02-20 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* OdbcDataReaderTest.cs: Added test for Bug#419224.
|
||||
|
||||
2008-12-31 Gert Driesen <[email protected]>
|
||||
|
||||
* OdbcCommandBuilderTest.cs: Improved GetDeleteCommand,
|
||||
|
||||
@@ -1116,6 +1116,44 @@ namespace MonoTests.System.Data
|
||||
Adaptador.Fill(Lector);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Bug419224Test ()
|
||||
{
|
||||
cmd = new OdbcCommand ("DROP TABLE IF EXISTS bug419224test");
|
||||
cmd.Connection = conn;
|
||||
cmd.ExecuteNonQuery ();
|
||||
|
||||
cmd = new OdbcCommand ("CREATE TABLE bug419224test (id_test INTEGER NOT NULL, payload TINYBLOB NOT NULL)");
|
||||
cmd.Connection = conn;
|
||||
cmd.ExecuteNonQuery ();
|
||||
|
||||
cmd = new OdbcCommand ("INSERT INTO odbc_test (id_test, payload) VALUES (1, 'test for bug419224)");
|
||||
cmd.Connection = conn;
|
||||
cmd.ExecuteNonQuery ();
|
||||
|
||||
OdbcDataAdapter Adaptador = new OdbcDataAdapter ();
|
||||
|
||||
DataSet Lector = new DataSet ();
|
||||
|
||||
Adaptador.SelectCommand = new OdbcCommand ("SELECT * FROM odbc_test WHERE id_test=1", (OdbcConnection) conn);
|
||||
Adaptador.Fill (Lector);
|
||||
Assert.AreEqual (Lector.Tables[0].Rows[0]["payload"], 1.2346);
|
||||
|
||||
|
||||
OdbcDataReader NewRdr = cmd.ExecuteReader();
|
||||
|
||||
// tinyblob column index:
|
||||
int TinyblobIdx = 1;
|
||||
|
||||
bool read = NewRdr.Read();
|
||||
|
||||
if (read)
|
||||
{
|
||||
bool ret = NewRdr.IsDBNull(TinyblobIdx);
|
||||
Assert.AreEqual (ret, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void DoExecuteNonQuery (OdbcConnection conn, string sql)
|
||||
{
|
||||
IDbCommand cmd = new OdbcCommand (sql, conn);
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-02-08 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* HttpClientTransportSink.cs: if we get an WebException that does not
|
||||
have a response, dispatch it to the sink.
|
||||
|
||||
2008-11-10 Michael Hutchinson <[email protected]>
|
||||
|
||||
* HttpServerTransportSink.cs: Seek to beginning of server response
|
||||
|
||||
+4
-2
@@ -80,8 +80,10 @@ namespace System.Runtime.Remoting.Channels.Http
|
||||
response = ex.Response;
|
||||
//only error 500 is handled by the remoting stack
|
||||
HttpWebResponse httpResponse = response as HttpWebResponse;
|
||||
if (httpResponse == null || httpResponse.StatusCode != HttpStatusCode.InternalServerError)
|
||||
throw;
|
||||
if (httpResponse == null || httpResponse.StatusCode != HttpStatusCode.InternalServerError) {
|
||||
sinkStack.DispatchException (ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//this is only valid after the response is fetched
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
2009-02-02 Raja R Harinath <[email protected]>
|
||||
|
||||
Fix #463999
|
||||
* CommittableTransaction.cs (CommitCallback): Handle the case
|
||||
where the callback is invoked before BeginCommit ends due to the
|
||||
async call ending synchronously.
|
||||
|
||||
2007-08-13 Miguel de Icaza <[email protected]>
|
||||
|
||||
* Transaction.cs: Remove the exception throwing on Dispose, from
|
||||
|
||||
@@ -66,6 +66,8 @@ namespace System.Transactions
|
||||
|
||||
private void CommitCallback (IAsyncResult ar)
|
||||
{
|
||||
if (asyncResult == null && ar.CompletedSynchronously)
|
||||
asyncResult = ar;
|
||||
callback (this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-03-06 Marek Habersack <[email protected]>
|
||||
|
||||
* JsonDeserializer.cs: unquoted key values must ignore leading
|
||||
and trailing whitespace
|
||||
|
||||
2008-12-05 Marek Habersack <[email protected]>
|
||||
|
||||
* JsonSerializer.cs: StringBuilder extension methods aren't used
|
||||
|
||||
@@ -277,8 +277,8 @@ namespace System.Web.Script.Serialization
|
||||
/*null N3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__,__,__,__},
|
||||
/*_. FX*/ {OK,OK,__,OE,__,AE,__,CM,__,__,__,__,__,__,FR,FR,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__,__,__,__,__,__},
|
||||
/*inval. IV*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__},
|
||||
/*unq.key UK*/ {__,UI,__,__,__,__,UE,__,__,__,__,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,__,UK,UK,UK,UK},
|
||||
/*unq.ign. UI*/ {__,UI,__,__,__,__,UE,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__},
|
||||
/*unq.key UK*/ {UI,UI,__,__,__,__,UE,__,__,__,__,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,UK,__,UK,UK,UK,UK},
|
||||
/*unq.ign. UI*/ {UI,UI,__,__,__,__,UE,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__},
|
||||
/*i1 I1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,I2,__,__,__,__,__,__,__,__,__,__,__,__},
|
||||
/*i2 I2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,I3,__,__,__,__,__,__,__,__,__,__,__,__,__,__},
|
||||
/*i3 I3*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,I4,__,__},
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
2009-01-26 Marek Habersack <[email protected]>
|
||||
|
||||
* ClientProxyHandler.cs: before generating the proxy check if the
|
||||
service type is decorated with the [ScriptService] custom
|
||||
attribute. Only such service types can be called from client
|
||||
JavaScript.
|
||||
|
||||
2008-09-23 Marek Habersack <[email protected]>
|
||||
|
||||
* LogicalTypeInfo.cs: do not use
|
||||
|
||||
@@ -36,7 +36,11 @@ namespace System.Web.Script.Services
|
||||
sealed class ClientProxyHandler : IHttpHandler
|
||||
{
|
||||
readonly LogicalTypeInfo _logicalTypeInfo;
|
||||
public ClientProxyHandler (Type type, string filePath) {
|
||||
readonly Type _type;
|
||||
|
||||
public ClientProxyHandler (Type type, string filePath)
|
||||
{
|
||||
_type = type;
|
||||
_logicalTypeInfo = LogicalTypeInfo.GetLogicalTypeInfo (type, filePath);
|
||||
}
|
||||
#region IHttpHandler Members
|
||||
@@ -45,8 +49,15 @@ namespace System.Web.Script.Services
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public void ProcessRequest (HttpContext context) {
|
||||
public void ProcessRequest (HttpContext context)
|
||||
{
|
||||
HttpResponse response = context.Response;
|
||||
object[] attributes = _type.GetCustomAttributes (typeof (ScriptServiceAttribute), true);
|
||||
if (attributes.Length == 0) {
|
||||
response.ContentType = "text/html";
|
||||
throw new InvalidOperationException ("Only Web services with a [ScriptService] attribute on the class definition can be called from script.");
|
||||
}
|
||||
|
||||
response.ContentType = "application/x-javascript";
|
||||
response.Cache.SetExpires (DateTime.Now.AddYears (1));
|
||||
response.Cache.SetValidUntilExpires (true);
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2009-03-03 Marek Habersack <[email protected]>
|
||||
|
||||
* ListView.cs: SetPageProperties invoked the
|
||||
PagePropertiesChanging event with the startRowIndex and
|
||||
maximumRows parameters reversed. Fixes bugs #481250 and #481252
|
||||
|
||||
* DataPagerField.cs: GetQueryModeStartRowIndex must return 'true'
|
||||
if in query mode. Fixes bug #481248
|
||||
|
||||
2008-11-28 Marek Habersack <[email protected]>
|
||||
|
||||
* ListView.cs: use the _correct_ operator when checking whether
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace System.Web.UI.WebControls
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddEventHandler (object key, EventHandler handler)
|
||||
|
||||
@@ -2000,7 +2000,7 @@ namespace System.Web.UI.WebControls
|
||||
|
||||
if (maximumRows != _maximumRows || startRowIndex != _startRowIndex) {
|
||||
if (databind) {
|
||||
var args = new PagePropertiesChangingEventArgs (maximumRows, startRowIndex);
|
||||
var args = new PagePropertiesChangingEventArgs (startRowIndex, maximumRows);
|
||||
OnPagePropertiesChanging (args);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
2009-01-26 Marek Habersack <[email protected]>
|
||||
|
||||
* ScriptManager.cs: before registering script service reference
|
||||
check if the service type is decorated with the [ScriptService]
|
||||
custom attribute. Only such service types can be called from
|
||||
client JavaScript.
|
||||
|
||||
2008-10-02 Marek Habersack <[email protected]>
|
||||
|
||||
* ScriptManager.cs: reverting revision 114552 since the real bug
|
||||
|
||||
@@ -862,10 +862,18 @@ namespace System.Web.UI
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
void RegisterServiceReference (Control control, ServiceReference serviceReference) {
|
||||
void RegisterServiceReference (Control control, ServiceReference serviceReference)
|
||||
{
|
||||
if (serviceReference.InlineScript) {
|
||||
string url = control.ResolveUrl (serviceReference.Path);
|
||||
LogicalTypeInfo logicalTypeInfo = LogicalTypeInfo.GetLogicalTypeInfo (WebServiceParser.GetCompiledType (url, Context), url);
|
||||
Type type = WebServiceParser.GetCompiledType (url, Context);
|
||||
if (type != null) {
|
||||
object[] attributes = type.GetCustomAttributes (typeof (ScriptServiceAttribute), true);
|
||||
if (attributes.Length == 0)
|
||||
throw new InvalidOperationException ("Only Web services with a [ScriptService] attribute on the class definition can be called from script.");
|
||||
}
|
||||
|
||||
LogicalTypeInfo logicalTypeInfo = LogicalTypeInfo.GetLogicalTypeInfo (type, url);
|
||||
RegisterClientScriptBlock (control, typeof (ScriptManager), url, logicalTypeInfo.Proxy, true);
|
||||
}
|
||||
else {
|
||||
@@ -873,6 +881,8 @@ namespace System.Web.UI
|
||||
string pathInfo = "/js.invoke";
|
||||
#else
|
||||
string pathInfo = "/js";
|
||||
if (IsDebuggingEnabled)
|
||||
pathInfo += "debug";
|
||||
#endif
|
||||
string url = String.Concat (control.ResolveClientUrl (serviceReference.Path), pathInfo);
|
||||
RegisterClientScriptInclude (control, typeof (ScriptManager), url, url);
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-03-06 Marek Habersack <[email protected]>
|
||||
|
||||
* JavaScriptSerializerTest.cs: added a test for unquoted tests
|
||||
surrounded with spaces.
|
||||
|
||||
2008-10-22 Marek Habersack <[email protected]>
|
||||
|
||||
* JavaScriptSerializerTest.cs: added tests for deserialization of
|
||||
|
||||
+15
-1
@@ -375,6 +375,20 @@ namespace Tests.System.Web.Script.Serialization
|
||||
Assert.AreEqual (1, dict ["itemOne"], "#B1");
|
||||
Assert.AreEqual (2, dict ["itemTwo"], "#B2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserializeUnquotedKeysWithSpaces ()
|
||||
{
|
||||
JavaScriptSerializer ser = new JavaScriptSerializer ();
|
||||
IDictionary dict = ser.Deserialize <Dictionary <string, object>> ("{ itemOne :\"1\",itemTwo:\"2\"}");
|
||||
|
||||
Assert.AreEqual ("1", dict ["itemOne"], "#A1");
|
||||
Assert.AreEqual ("2", dict ["itemTwo"], "#A2");
|
||||
|
||||
dict = ser.Deserialize <Dictionary <string, object>> ("{ itemOne :1, itemTwo :2}");
|
||||
Assert.AreEqual (1, dict ["itemOne"], "#B1");
|
||||
Assert.AreEqual (2, dict ["itemTwo"], "#B2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserialize () {
|
||||
@@ -802,7 +816,7 @@ namespace Tests.System.Web.Script.Serialization
|
||||
string s = ser.Serialize(pc);
|
||||
MyPointContainer pc2 = ser.Deserialize<MyPointContainer>(s);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void MaxJsonLengthDeserializeObject ()
|
||||
{
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
2009-02-18 Marek Habersack <[email protected]>
|
||||
|
||||
* UrlPattern.cs: TrySubstitute now gets the collection of default
|
||||
values and uses it to replace url segments instead of failing when
|
||||
the passed values collection is missing a segment.
|
||||
Do not use the tokens array in Match.
|
||||
|
||||
* RouteCollection.cs: check if name is null or empty, not just
|
||||
null in GetVirtualPath
|
||||
|
||||
* Route.cs: url.TrySubstitute should be passed the defaults
|
||||
collection when called from GetVirtualPath
|
||||
|
||||
2009-02-14 Marek Habersack <[email protected]>
|
||||
|
||||
* UrlPattern.cs: use the defaults collection when matching a path
|
||||
and segments are missing.
|
||||
|
||||
* RouteCollection.cs: GetRouteData must use VirtualPathProvider
|
||||
to check for virtual path existence.
|
||||
|
||||
2008-10-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* UrlPattern.cs : fixed possible out-of-range case ("tableName/" in
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace System.Web.Routing
|
||||
values = requestContext.RouteData.Values;
|
||||
|
||||
string s;
|
||||
if (!url.TrySubstitute (values, out s))
|
||||
if (!url.TrySubstitute (values, Defaults, out s))
|
||||
return null;
|
||||
|
||||
return new VirtualPathData (this, s);
|
||||
|
||||
@@ -119,12 +119,11 @@ namespace System.Web.Routing
|
||||
|
||||
if (!RouteExistingFiles) {
|
||||
var path = httpContext.Request.AppRelativeCurrentExecutionFilePath;
|
||||
if (path.StartsWith ("~/", StringComparison.Ordinal))
|
||||
path = path.Substring (2);
|
||||
if (File.Exists (path))
|
||||
VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider;
|
||||
if (path != "~/" && vpp != null && (vpp.FileExists (path) || vpp.DirectoryExists (path)))
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (Count == 0)
|
||||
return null;
|
||||
|
||||
@@ -151,7 +150,7 @@ namespace System.Web.Routing
|
||||
return null;
|
||||
|
||||
VirtualPathData vp = null;
|
||||
if (name != null) {
|
||||
if (!String.IsNullOrEmpty (name)) {
|
||||
RouteBase rb = this [name];
|
||||
if (rb != null)
|
||||
vp = rb.GetVirtualPath (requestContext, values);
|
||||
|
||||
@@ -36,8 +36,10 @@ namespace System.Web.Routing
|
||||
{
|
||||
internal class UrlPattern
|
||||
{
|
||||
int segmentsCount;
|
||||
string [] segments;
|
||||
bool [] segment_flags;
|
||||
int [] segmentLengths;
|
||||
bool [] segment_flags;
|
||||
string [] tokens;
|
||||
|
||||
public UrlPattern (string url)
|
||||
@@ -60,21 +62,25 @@ namespace System.Web.Routing
|
||||
var tokens = new List<string> ();
|
||||
|
||||
segments = Url.Split ('/');
|
||||
segment_flags = new bool [segments.Length];
|
||||
|
||||
for (int i = 0; i < segments.Length; i++) {
|
||||
segmentsCount = segments.Length;
|
||||
segment_flags = new bool [segmentsCount];
|
||||
segmentLengths = new int [segmentsCount];
|
||||
|
||||
for (int i = 0; i < segmentsCount; i++) {
|
||||
string s = segments [i];
|
||||
if (s.Length == 0 && i < segments.Length - 1)
|
||||
int slen = s.Length;
|
||||
segmentLengths [i] = slen;
|
||||
if (slen == 0 && i < segmentsCount - 1)
|
||||
throw new ArgumentException ("Consecutive URL segment separators '/' are not allowed");
|
||||
int from = 0;
|
||||
while (from < s.Length) {
|
||||
while (from < slen) {
|
||||
int start = s.IndexOf ('{', from);
|
||||
if (start == s.Length - 1)
|
||||
if (start == slen - 1)
|
||||
throw new ArgumentException ("Unterminated URL parameter. It must contain matching '}'");
|
||||
if (start < 0) {
|
||||
if (s.IndexOf ('}', from) >= from)
|
||||
throw new ArgumentException ("Unmatched URL parameter closer '}'. A corresponding '{' must precede");
|
||||
from = s.Length;
|
||||
from = slen;
|
||||
continue;
|
||||
}
|
||||
segment_flags [i] = true;
|
||||
@@ -96,9 +102,21 @@ namespace System.Web.Routing
|
||||
this.tokens = tokens.ToArray ();
|
||||
}
|
||||
|
||||
string SegmentToKey (string segment)
|
||||
{
|
||||
int start = segment.IndexOf ('{');
|
||||
int end = segment.IndexOf ('}');
|
||||
if (start == -1)
|
||||
start = 0;
|
||||
else
|
||||
start++;
|
||||
|
||||
if (end == -1)
|
||||
end = segment.Length;
|
||||
return segment.Substring (start, end - start);
|
||||
}
|
||||
|
||||
RouteValueDictionary tmp = new RouteValueDictionary ();
|
||||
|
||||
// FIXME: how is "defaults" used?
|
||||
public RouteValueDictionary Match (string path, RouteValueDictionary defaults)
|
||||
{
|
||||
tmp.Clear ();
|
||||
@@ -108,15 +126,31 @@ namespace System.Web.Routing
|
||||
return tmp;
|
||||
|
||||
string [] argSegs = path.Split ('/');
|
||||
if (argSegs.Length != segments.Length)
|
||||
int argsLen = argSegs.Length;
|
||||
bool haveDefaults = defaults != null && defaults.Count > 0;
|
||||
if (!haveDefaults && argsLen != segmentsCount)
|
||||
return null;
|
||||
|
||||
for (int i = 0; i < segments.Length; i++) {
|
||||
for (int i = 0; i < segmentsCount; i++) {
|
||||
if (segment_flags [i]) {
|
||||
string t = segments [i];
|
||||
string v = argSegs [i];
|
||||
if (v.Length == 0)
|
||||
return null; // ends with '/' while more tokens are expected.
|
||||
string v = i < argsLen ? argSegs [i] : null;
|
||||
|
||||
if (String.IsNullOrEmpty (v)) {
|
||||
string key = SegmentToKey (segments [i]);
|
||||
object o;
|
||||
if (haveDefaults && !defaults.TryGetValue (key, out o))
|
||||
return null; // ends with '/' while more
|
||||
// tokens are expected and
|
||||
// there are is no default
|
||||
// value in the defaults
|
||||
// dictionary.
|
||||
|
||||
v = o as string;
|
||||
if (v == null)
|
||||
throw new InvalidOperationException ("The RouteData must contain an item named '" + key + "' with a string value.");
|
||||
}
|
||||
|
||||
int tfrom = 0, vfrom = 0;
|
||||
while (tfrom < t.Length) {
|
||||
int start = t.IndexOf ('{', tfrom);
|
||||
@@ -153,7 +187,7 @@ namespace System.Web.Routing
|
||||
}
|
||||
tfrom = end + 1;
|
||||
}
|
||||
} else if (segments [i] != argSegs [i])
|
||||
} else if (i > argsLen || segments [i] != argSegs [i])
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -163,17 +197,27 @@ namespace System.Web.Routing
|
||||
static readonly string [] substsep = {"{{"};
|
||||
|
||||
// it may return null for invalid values.
|
||||
public bool TrySubstitute (RouteValueDictionary values, out string value)
|
||||
public bool TrySubstitute (RouteValueDictionary values, RouteValueDictionary defaults, out string value)
|
||||
{
|
||||
var replacements = new RouteValueDictionary ();
|
||||
if (values == null) {
|
||||
value = Url;
|
||||
return true;
|
||||
} else {
|
||||
object val;
|
||||
bool missing;
|
||||
foreach (string token in tokens) {
|
||||
if (!values.ContainsKey (token)) {
|
||||
val = null;
|
||||
missing = false;
|
||||
if (!values.TryGetValue (token, out val))
|
||||
if (defaults == null || !defaults.TryGetValue (token, out val))
|
||||
missing = true;
|
||||
if (missing) {
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
replacements.Add (token, val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +225,7 @@ namespace System.Web.Routing
|
||||
string [] arr = Url.Split (substsep, StringSplitOptions.None);
|
||||
for (int i = 0; i < arr.Length; i++) {
|
||||
string s = arr [i];
|
||||
foreach (var p in values)
|
||||
foreach (var p in replacements)
|
||||
s = s.Replace ("{" + p.Key + "}", p.Value.ToString ());
|
||||
arr [i] = s;
|
||||
}
|
||||
|
||||
@@ -258,6 +258,7 @@ namespace MonoTests.System.Web.Routing
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore ("Pending testing - might be invalid test")]
|
||||
public void GetRouteData7 ()
|
||||
{
|
||||
var r = new Route ("{table}/{action}.aspx", null);
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2009-02-05 Marek Habersack <[email protected]>
|
||||
|
||||
* Makefile (TEST_RESOURCE_FILES): added
|
||||
Test/mainsoft/NunitWebResources/LoginDisplayRememberMe.aspx
|
||||
|
||||
2009-01-27 Marek Habersack <[email protected]>
|
||||
|
||||
* System.Web.dll.sources: added System.Web.Util/SearchPattern.cs
|
||||
|
||||
2009-01-20 Marek Habersack <[email protected]>
|
||||
|
||||
* System.Web.dll.sources: added System.Web.UI.WebControls/Substitution.cs
|
||||
|
||||
@@ -158,7 +158,8 @@ TEST_RESOURCE_FILES = \
|
||||
Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.aspx \
|
||||
Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.master \
|
||||
Test/mainsoft/NunitWebResources/MissingMasterFile.aspx \
|
||||
Test/mainsoft/NunitWebResources/CustomSectionEmptyCollection.aspx
|
||||
Test/mainsoft/NunitWebResources/CustomSectionEmptyCollection.aspx \
|
||||
Test/mainsoft/NunitWebResources/LoginDisplayRememberMe.aspx
|
||||
|
||||
RESX_DIST = resources/TranslationResources.resx
|
||||
ifeq (net_2_0, $(PROFILE))
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace System.Web.Compilation
|
||||
}
|
||||
|
||||
CodeDomProvider provider = null;
|
||||
CompilationSection compilationSection = WebConfigurationManager.GetSection ("system.web/compilation") as CompilationSection;
|
||||
CompilationSection compilationSection = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
|
||||
if (compilerInfo == null) {
|
||||
if (!CodeDomProvider.IsDefinedLanguage (compilationSection.DefaultLanguage))
|
||||
throw new HttpException ("Failed to retrieve default source language");
|
||||
@@ -359,7 +359,7 @@ namespace System.Web.Compilation
|
||||
bool ProcessAppCodeDir (string appCode, AppCodeAssembly defasm)
|
||||
{
|
||||
// First process the codeSubDirectories
|
||||
CompilationSection cs = (CompilationSection) WebConfigurationManager.GetSection ("system.web/compilation");
|
||||
CompilationSection cs = (CompilationSection) WebConfigurationManager.GetWebApplicationSection ("system.web/compilation");
|
||||
|
||||
if (cs != null) {
|
||||
string aname;
|
||||
@@ -626,7 +626,7 @@ namespace System.Web.Compilation
|
||||
return;
|
||||
|
||||
string appCode = Path.Combine (HttpRuntime.AppDomainAppPath, "App_Code");
|
||||
ProfileSection ps = WebConfigurationManager.GetSection ("system.web/profile") as ProfileSection;
|
||||
ProfileSection ps = WebConfigurationManager.GetWebApplicationSection ("system.web/profile") as ProfileSection;
|
||||
bool haveAppCodeDir = Directory.Exists (appCode);
|
||||
bool haveCustomProfile = HaveCustomProfile (ps);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace System.Web.Compilation
|
||||
this.baseAssemblyDirectory = Path.GetDirectoryName (baseAssemblyPath);
|
||||
this.canonicAssemblyName = canonicAssemblyName;
|
||||
|
||||
config = WebConfigurationManager.GetSection ("system.web/compilation") as CompilationSection;
|
||||
config = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
|
||||
if (config == null || !CodeDomProvider.IsDefinedLanguage (config.DefaultLanguage))
|
||||
throw new ApplicationException ("Could not get the default compiler.");
|
||||
ci = CodeDomProvider.GetCompilerInfo (config.DefaultLanguage);
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
// System.Web.Compilation.AppResourceFilesCollection
|
||||
//
|
||||
// Authors:
|
||||
// Marek Habersack (grendello@gmail.com)
|
||||
// Marek Habersack (mhabersack@novell.com)
|
||||
//
|
||||
// (C) 2006 Marek Habersack
|
||||
// (C) 2007-2009 Novell, Inc http://novell.com/
|
||||
//
|
||||
|
||||
//
|
||||
@@ -33,6 +34,7 @@ using System.CodeDom;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
@@ -44,8 +46,167 @@ using System.Web.Util;
|
||||
|
||||
namespace System.Web.Compilation
|
||||
{
|
||||
internal class AppResourcesCompiler
|
||||
class AppResourcesCompiler
|
||||
{
|
||||
class TypeResolutionService : ITypeResolutionService
|
||||
{
|
||||
List <Assembly> referencedAssemblies;
|
||||
Dictionary <string, Type> mappedTypes;
|
||||
|
||||
public Assembly GetAssembly (AssemblyName name)
|
||||
{
|
||||
return GetAssembly (name, false);
|
||||
}
|
||||
|
||||
public Assembly GetAssembly (AssemblyName name, bool throwOnError)
|
||||
{
|
||||
try {
|
||||
return Assembly.Load (name);
|
||||
} catch {
|
||||
if (throwOnError)
|
||||
throw;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ReferenceAssembly (AssemblyName name)
|
||||
{
|
||||
if (referencedAssemblies == null)
|
||||
referencedAssemblies = new List <Assembly> ();
|
||||
|
||||
Assembly asm = GetAssembly (name, false);
|
||||
if (asm == null)
|
||||
return;
|
||||
|
||||
if (referencedAssemblies.Contains (asm))
|
||||
return;
|
||||
|
||||
referencedAssemblies.Add (asm);
|
||||
}
|
||||
|
||||
public string GetPathOfAssembly (AssemblyName name)
|
||||
{
|
||||
if (name == null)
|
||||
return null;
|
||||
|
||||
Assembly asm = GetAssembly (name, false);
|
||||
if (asm == null)
|
||||
return null;
|
||||
|
||||
return asm.Location;
|
||||
}
|
||||
|
||||
public Type GetType (string name)
|
||||
{
|
||||
return GetType (name, false, false);
|
||||
}
|
||||
|
||||
public Type GetType (string name, bool throwOnError)
|
||||
{
|
||||
return GetType (name, throwOnError, false);
|
||||
}
|
||||
|
||||
public Type GetType (string name, bool throwOnError, bool ignoreCase)
|
||||
{
|
||||
if (String.IsNullOrEmpty (name)) {
|
||||
if (throwOnError)
|
||||
throw new ArgumentNullException ("name");
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
int idx = name.IndexOf (',');
|
||||
Type type = null;
|
||||
if (idx == -1) {
|
||||
type = MapType (name, false);
|
||||
if (type != null)
|
||||
return type;
|
||||
|
||||
type = FindInAssemblies (name, ignoreCase);
|
||||
if (type == null) {
|
||||
if (throwOnError)
|
||||
throw new InvalidOperationException ("Type '" + name + "' is not fully qualified and there are no referenced assemblies.");
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
type = MapType (name, true);
|
||||
if (type != null)
|
||||
return type;
|
||||
|
||||
return Type.GetType (name, throwOnError, ignoreCase);
|
||||
}
|
||||
|
||||
Type MapType (string name, bool full)
|
||||
{
|
||||
if (mappedTypes == null)
|
||||
mappedTypes = new Dictionary <string, Type> (StringComparer.Ordinal);
|
||||
|
||||
Type ret;
|
||||
if (mappedTypes.TryGetValue (name, out ret))
|
||||
return ret;
|
||||
|
||||
if (!full) {
|
||||
if (String.Compare (name, "ResXDataNode", StringComparison.Ordinal) == 0)
|
||||
return AddMappedType (name, typeof (ResXDataNode));
|
||||
if (String.Compare (name, "ResXFileRef", StringComparison.Ordinal) == 0)
|
||||
return AddMappedType (name, typeof (ResXFileRef));
|
||||
if (String.Compare (name, "ResXNullRef", StringComparison.Ordinal) == 0)
|
||||
return AddMappedType (name, typeof (ResXNullRef));
|
||||
if (String.Compare (name, "ResXResourceReader", StringComparison.Ordinal) == 0)
|
||||
return AddMappedType (name, typeof (ResXResourceReader));
|
||||
if (String.Compare (name, "ResXResourceWriter", StringComparison.Ordinal) == 0)
|
||||
return AddMappedType (name, typeof (ResXResourceWriter));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (name.IndexOf ("System.Windows.Forms") == -1)
|
||||
return null;
|
||||
|
||||
if (name.IndexOf ("ResXDataNode", StringComparison.Ordinal) != -1)
|
||||
return AddMappedType (name, typeof (ResXDataNode));
|
||||
if (name.IndexOf ("ResXFileRef", StringComparison.Ordinal) != -1)
|
||||
return AddMappedType (name, typeof (ResXFileRef));
|
||||
if (name.IndexOf ("ResXNullRef", StringComparison.Ordinal) != -1)
|
||||
return AddMappedType (name, typeof (ResXNullRef));
|
||||
if (name.IndexOf ("ResXResourceReader", StringComparison.Ordinal) != -1)
|
||||
return AddMappedType (name, typeof (ResXResourceReader));
|
||||
if (name.IndexOf ("ResXResourceWriter", StringComparison.Ordinal) != -1)
|
||||
return AddMappedType (name, typeof (ResXResourceWriter));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Type AddMappedType (string name, Type type)
|
||||
{
|
||||
mappedTypes.Add (name, type);
|
||||
return type;
|
||||
}
|
||||
|
||||
Type FindInAssemblies (string name, bool ignoreCase)
|
||||
{
|
||||
Type ret = Type.GetType (name, false);
|
||||
if (ret != null)
|
||||
return ret;
|
||||
|
||||
if (referencedAssemblies == null || referencedAssemblies.Count == 0)
|
||||
return null;
|
||||
|
||||
foreach (Assembly asm in referencedAssemblies) {
|
||||
ret = asm.GetType (name, false, ignoreCase);
|
||||
if (ret != null)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const string cachePrefix = "@@LocalResourcesAssemblies";
|
||||
public const string DefaultCultureKey = ".:!DefaultCulture!:.";
|
||||
|
||||
@@ -541,7 +702,7 @@ namespace System.Web.Compilation
|
||||
try {
|
||||
source = new FileStream (path, FileMode.Open, FileAccess.Read);
|
||||
destination = new FileStream (resource, FileMode.Create, FileAccess.Write);
|
||||
reader = GetReaderForKind (arfi.Kind, source);
|
||||
reader = GetReaderForKind (arfi.Kind, source, path);
|
||||
writer = new ResourceWriter (destination);
|
||||
foreach (DictionaryEntry de in reader) {
|
||||
object val = de.Value;
|
||||
@@ -566,11 +727,14 @@ namespace System.Web.Compilation
|
||||
return resource;
|
||||
}
|
||||
|
||||
IResourceReader GetReaderForKind (AppResourceFileKind kind, Stream stream)
|
||||
IResourceReader GetReaderForKind (AppResourceFileKind kind, Stream stream, string path)
|
||||
{
|
||||
switch (kind) {
|
||||
case AppResourceFileKind.ResX:
|
||||
return new ResXResourceReader (stream);
|
||||
var ret = new ResXResourceReader (stream, new TypeResolutionService ());
|
||||
if (!String.IsNullOrEmpty (path))
|
||||
ret.BasePath = Path.GetDirectoryName (path);
|
||||
return ret;
|
||||
|
||||
case AppResourceFileKind.Resource:
|
||||
return new ResourceReader (stream);
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace System.Web.Compilation
|
||||
if (files == null || files.Length == 0)
|
||||
return;
|
||||
|
||||
CompilationSection cs = WebConfigurationManager.GetSection ("system.web/compilation") as CompilationSection;
|
||||
CompilationSection cs = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
|
||||
if (cs == null)
|
||||
throw new HttpException ("Unable to determine default compilation language.");
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ namespace System.Web.Compilation
|
||||
|
||||
void RegisterConfigControls ()
|
||||
{
|
||||
PagesSection pages = WebConfigurationManager.GetSection ("system.web/pages") as PagesSection;
|
||||
PagesSection pages = WebConfigurationManager.GetWebApplicationSection ("system.web/pages") as PagesSection;
|
||||
if (pages == null)
|
||||
return;
|
||||
|
||||
@@ -437,7 +437,7 @@ namespace System.Web.Compilation
|
||||
#endif
|
||||
string typeName = String.Concat (nameSpace, ".", componentName);
|
||||
if (assembly != null)
|
||||
return assembly.GetType (typeName, true, true);
|
||||
return assembly.GetType (typeName, false, true);
|
||||
|
||||
#if NET_2_0
|
||||
IList tla = BuildManager.TopLevelAssemblies;
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace System.Web.Compilation
|
||||
bool inForm;
|
||||
bool useOtherTags;
|
||||
TagType lastTag;
|
||||
|
||||
|
||||
public AspGenerator (TemplateParser tparser)
|
||||
{
|
||||
this.tparser = tparser;
|
||||
@@ -215,6 +215,17 @@ namespace System.Web.Compilation
|
||||
public string Filename {
|
||||
get { return pstack.Filename; }
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
PageParserFilter PageParserFilter {
|
||||
get {
|
||||
if (tparser == null)
|
||||
return null;
|
||||
|
||||
return tparser.PageParserFilter;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BaseCompiler GetCompilerFromType ()
|
||||
{
|
||||
@@ -241,6 +252,10 @@ namespace System.Web.Compilation
|
||||
parser.Error += new ParseErrorHandler (ParseError);
|
||||
parser.TagParsed += new TagParsedHandler (TagParsed);
|
||||
parser.TextParsed += new TextParsedHandler (TextParsed);
|
||||
#if NET_2_0
|
||||
parser.ParsingComplete += new ParsingCompleteHandler (ParsingCompleted);
|
||||
tparser.AspGenerator = this;
|
||||
#endif
|
||||
if (!pstack.Push (parser))
|
||||
throw new ParseException (Location, "Infinite recursion detected including file: " + filename);
|
||||
|
||||
@@ -449,8 +464,10 @@ namespace System.Web.Compilation
|
||||
sb.AppendFormat ("\t<{0}", tagid);
|
||||
foreach (string key in attributes.Keys) {
|
||||
value = attributes [key] as string;
|
||||
if (value == null || value.Length < 16) // optimization
|
||||
if (value == null || value.Length < 16) { // optimization
|
||||
sb.AppendFormat (" {0}=\"{1}\"", key, value);
|
||||
continue;
|
||||
}
|
||||
|
||||
match = runatServer.Match (attributes [key] as string);
|
||||
if (!match.Success) {
|
||||
@@ -466,13 +483,14 @@ namespace System.Web.Compilation
|
||||
group = match.Groups [0];
|
||||
index = group.Index;
|
||||
length = group.Length;
|
||||
|
||||
if (index > 0)
|
||||
TextParsed (location, String.Format (" {0}=\"{1}", key, value.Substring (0, index)));
|
||||
|
||||
TextParsed (location, String.Format (" {0}=\"{1}", key, index > 0 ? value.Substring (0, index) : String.Empty));;
|
||||
FlushText ();
|
||||
ParseAttributeTag (group.Value);
|
||||
if (index + length < value.Length)
|
||||
TextParsed (location, value.Substring (index + length) + "\"");
|
||||
else
|
||||
TextParsed (location, "\"");
|
||||
}
|
||||
if (type == TagType.SelfClosing)
|
||||
sb.Append ("/>");
|
||||
@@ -495,6 +513,17 @@ namespace System.Web.Compilation
|
||||
if (text.Length > 0)
|
||||
FlushText ();
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
void ParsingCompleted ()
|
||||
{
|
||||
PageParserFilter pfilter = PageParserFilter;
|
||||
if (pfilter == null)
|
||||
return;
|
||||
|
||||
pfilter.ParseComplete (rootBuilder);
|
||||
}
|
||||
#endif
|
||||
|
||||
void TagParsed (ILocation location, TagType tagtype, string tagid, TagAttributes attributes)
|
||||
{
|
||||
@@ -641,7 +670,7 @@ namespace System.Web.Compilation
|
||||
if (this.text.Length > 0)
|
||||
FlushText (true);
|
||||
CodeRenderParser r = new CodeRenderParser (text, stack.Builder);
|
||||
r.AddChildren ();
|
||||
r.AddChildren (this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -663,6 +692,11 @@ namespace System.Web.Compilation
|
||||
return;
|
||||
|
||||
if (inScript) {
|
||||
#if NET_2_0
|
||||
PageParserFilter pfilter = PageParserFilter;
|
||||
if (pfilter != null && !pfilter.ProcessCodeConstruct (CodeConstructType.ScriptTag, t))
|
||||
return;
|
||||
#endif
|
||||
tparser.Scripts.Add (new ServerSideScript (t, new System.Web.Compilation.Location (tparser.Location)));
|
||||
return;
|
||||
}
|
||||
@@ -726,6 +760,16 @@ namespace System.Web.Compilation
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
public void AddControl (Type type, IDictionary attributes)
|
||||
{
|
||||
ControlBuilder parent = stack.Builder;
|
||||
ControlBuilder builder = ControlBuilder.CreateBuilderFromType (tparser, parent, type, null, null,
|
||||
attributes, location.BeginLine,
|
||||
location.Filename);
|
||||
if (builder != null)
|
||||
parent.AppendSubBuilder (builder);
|
||||
}
|
||||
|
||||
bool ProcessTag (ILocation location, string tagid, TagAttributes atts, TagType tagtype)
|
||||
{
|
||||
@@ -765,6 +809,10 @@ namespace System.Web.Compilation
|
||||
return false;
|
||||
|
||||
#if NET_2_0
|
||||
PageParserFilter pfilter = PageParserFilter;
|
||||
if (pfilter != null && !pfilter.AllowControl (builder.ControlType, builder))
|
||||
throw new ParseException (Location, "Control type '" + builder.ControlType + "' not allowed.");
|
||||
|
||||
if (!OtherControlsAllowed (builder))
|
||||
throw new ParseException (Location, "Only Content controls are allowed directly in a content page that contains Content controls.");
|
||||
#endif
|
||||
@@ -906,8 +954,32 @@ namespace System.Web.Compilation
|
||||
return true;
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
CodeConstructType MapTagTypeToConstructType (TagType tagtype)
|
||||
{
|
||||
switch (tagtype) {
|
||||
case TagType.DataBinding:
|
||||
return CodeConstructType.ExpressionSnippet;
|
||||
|
||||
case TagType.CodeRender:
|
||||
return CodeConstructType.CodeSnippet;
|
||||
|
||||
case TagType.CodeRenderExpression:
|
||||
return CodeConstructType.DataBindingSnippet;
|
||||
|
||||
default:
|
||||
throw new InvalidOperationException ("Unexpected tag type.");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
bool ProcessCode (TagType tagtype, string code, ILocation location)
|
||||
{
|
||||
#if NET_2_0
|
||||
PageParserFilter pfilter = PageParserFilter;
|
||||
if (pfilter != null && (!pfilter.AllowCode || !pfilter.ProcessCodeConstruct (MapTagTypeToConstructType (tagtype), code)))
|
||||
return true;
|
||||
#endif
|
||||
ControlBuilder b = null;
|
||||
if (tagtype == TagType.CodeRender)
|
||||
b = new CodeRenderBuilder (code, false, location);
|
||||
@@ -935,7 +1007,7 @@ namespace System.Web.Compilation
|
||||
return;
|
||||
|
||||
#if NET_2_0
|
||||
CompilationSection section = (CompilationSection) WebConfigurationManager.GetSection ("system.web/compilation");
|
||||
CompilationSection section = (CompilationSection) WebConfigurationManager.GetWebApplicationSection ("system.web/compilation");
|
||||
if (section.Compilers[tparser.Language] != section.Compilers[lang])
|
||||
#else
|
||||
CompilationConfiguration cfg = CompilationConfiguration.GetInstance (HttpContext.Current);
|
||||
@@ -951,22 +1023,24 @@ namespace System.Web.Compilation
|
||||
{
|
||||
string str;
|
||||
ControlBuilder builder;
|
||||
|
||||
AspGenerator generator;
|
||||
|
||||
public CodeRenderParser (string str, ControlBuilder builder)
|
||||
{
|
||||
this.str = str;
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
public void AddChildren ()
|
||||
public void AddChildren (AspGenerator generator)
|
||||
{
|
||||
this.generator = generator;
|
||||
int index = str.IndexOf ("<%");
|
||||
if (index > 0) {
|
||||
TextParsed (null, str.Substring (0, index));
|
||||
str = str.Substring (index);
|
||||
}
|
||||
|
||||
AspParser parser = new AspParser ("@@inner_string@@", new StringReader (str));
|
||||
AspParser parser = new AspParser ("@@nested_tag@@", new StringReader (str));
|
||||
parser.Error += new ParseErrorHandler (ParseError);
|
||||
parser.TagParsed += new TagParsedHandler (TagParsed);
|
||||
parser.TextParsed += new TextParsedHandler (TextParsed);
|
||||
@@ -975,14 +1049,31 @@ namespace System.Web.Compilation
|
||||
|
||||
void TagParsed (ILocation location, TagType tagtype, string tagid, TagAttributes attributes)
|
||||
{
|
||||
if (tagtype == TagType.CodeRender)
|
||||
builder.AppendSubBuilder (new CodeRenderBuilder (tagid, false, location));
|
||||
else if (tagtype == TagType.CodeRenderExpression)
|
||||
builder.AppendSubBuilder (new CodeRenderBuilder (tagid, true, location));
|
||||
else if (tagtype == TagType.DataBinding)
|
||||
builder.AppendSubBuilder (new DataBindingBuilder (tagid, location));
|
||||
else
|
||||
builder.AppendLiteralString (location.PlainText);
|
||||
switch (tagtype) {
|
||||
case TagType.CodeRender:
|
||||
builder.AppendSubBuilder (new CodeRenderBuilder (tagid, false, location));
|
||||
break;
|
||||
|
||||
case TagType.CodeRenderExpression:
|
||||
builder.AppendSubBuilder (new CodeRenderBuilder (tagid, true, location));
|
||||
break;
|
||||
|
||||
case TagType.DataBinding:
|
||||
builder.AppendSubBuilder (new DataBindingBuilder (tagid, location));
|
||||
break;
|
||||
|
||||
case TagType.Tag:
|
||||
case TagType.SelfClosing:
|
||||
if (generator != null)
|
||||
generator.TagParsed (location, tagtype, tagid, attributes);
|
||||
else
|
||||
goto default;
|
||||
break;
|
||||
|
||||
default:
|
||||
builder.AppendLiteralString (location.PlainText);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TextParsed (ILocation location, string text)
|
||||
|
||||
@@ -41,14 +41,18 @@ namespace System.Web.Compilation
|
||||
delegate void ParseErrorHandler (ILocation location, string message);
|
||||
delegate void TextParsedHandler (ILocation location, string text);
|
||||
delegate void TagParsedHandler (ILocation location, TagType tagtype, string id, TagAttributes attributes);
|
||||
|
||||
#if NET_2_0
|
||||
delegate void ParsingCompleteHandler ();
|
||||
#endif
|
||||
|
||||
class AspParser : ILocation
|
||||
{
|
||||
static readonly object errorEvent = new object ();
|
||||
static readonly object tagParsedEvent = new object ();
|
||||
static readonly object textParsedEvent = new object ();
|
||||
|
||||
#if NET_2_0
|
||||
static readonly object parsingCompleteEvent = new object();
|
||||
|
||||
byte[] md5checksum;
|
||||
#endif
|
||||
AspTokenizer tokenizer;
|
||||
@@ -76,6 +80,13 @@ namespace System.Web.Compilation
|
||||
remove { events.RemoveHandler (textParsedEvent, value); }
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public event ParsingCompleteHandler ParsingComplete {
|
||||
add { events.AddHandler (parsingCompleteEvent, value); }
|
||||
remove { events.RemoveHandler (parsingCompleteEvent, value); }
|
||||
}
|
||||
#endif
|
||||
|
||||
public AspParser (string filename, TextReader input)
|
||||
{
|
||||
this.filename = filename;
|
||||
@@ -217,6 +228,10 @@ namespace System.Web.Compilation
|
||||
EndElement ();
|
||||
OnTextParsed (text.ToString ());
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
OnParsingComplete ();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GetInclude (string str, out string pathType, out string filename)
|
||||
@@ -510,6 +525,16 @@ namespace System.Web.Compilation
|
||||
(varname ? TagType.CodeRenderExpression : TagType.CodeRender));
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder ("AspParser {");
|
||||
if (filename != null && filename.Length > 0)
|
||||
sb.AppendFormat ("{0}:{1}.{2}", filename, beginLine, beginColumn);
|
||||
sb.Append ('}');
|
||||
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
void OnError (string msg)
|
||||
{
|
||||
ParseErrorHandler eh = events [errorEvent] as ParseErrorHandler;
|
||||
@@ -530,7 +555,15 @@ namespace System.Web.Compilation
|
||||
if (eh != null)
|
||||
eh (this, text);
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
void OnParsingComplete ()
|
||||
{
|
||||
ParsingCompleteHandler eh = events [parsingCompleteEvent] as ParsingCompleteHandler;
|
||||
if (eh != null)
|
||||
eh ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,20 @@ namespace System.Web.Compilation
|
||||
|
||||
class AspTokenizer
|
||||
{
|
||||
class PutBackItem
|
||||
{
|
||||
public readonly string Value;
|
||||
public readonly int Position;
|
||||
public readonly int CurrentToken;
|
||||
|
||||
public PutBackItem (string value, int position, int currentToken)
|
||||
{
|
||||
Value = value;
|
||||
Position = position;
|
||||
CurrentToken = currentToken;
|
||||
}
|
||||
}
|
||||
|
||||
static char [] lfcr = new char [] { '\n', '\r' };
|
||||
TextReader sr;
|
||||
int current_token;
|
||||
@@ -64,6 +78,7 @@ namespace System.Web.Compilation
|
||||
bool have_unget;
|
||||
int unget_value;
|
||||
string val;
|
||||
Stack putBackBuffer;
|
||||
|
||||
public AspTokenizer (TextReader reader)
|
||||
{
|
||||
@@ -82,18 +97,28 @@ namespace System.Web.Compilation
|
||||
|
||||
public void put_back ()
|
||||
{
|
||||
if (hasPutBack)
|
||||
if (hasPutBack && !inTag)
|
||||
throw new HttpException ("put_back called twice!");
|
||||
|
||||
hasPutBack = true;
|
||||
position -= Value.Length;
|
||||
if (putBackBuffer == null)
|
||||
putBackBuffer = new Stack ();
|
||||
|
||||
string val = Value;
|
||||
putBackBuffer.Push (new PutBackItem (val, position, current_token));
|
||||
position -= val.Length;
|
||||
}
|
||||
|
||||
public int get_token ()
|
||||
{
|
||||
if (hasPutBack){
|
||||
hasPutBack = false;
|
||||
position += Value.Length;
|
||||
if (hasPutBack) {
|
||||
PutBackItem pbi = putBackBuffer.Pop () as PutBackItem;
|
||||
hasPutBack = putBackBuffer.Count > 0;
|
||||
position = pbi.Position;
|
||||
have_value = false;
|
||||
val = null;
|
||||
sb = new StringBuilder (pbi.Value);
|
||||
current_token = pbi.CurrentToken;
|
||||
return current_token;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,10 +119,7 @@ namespace System.Web.Compilation {
|
||||
units = new List <CodeCompileUnit> ();
|
||||
|
||||
CompilationSection section;
|
||||
if (virtualPath != null)
|
||||
section = (CompilationSection) WebConfigurationManager.GetSection ("system.web/compilation", virtualPath.Absolute);
|
||||
else
|
||||
section = (CompilationSection) WebConfigurationManager.GetSection ("system.web/compilation");
|
||||
section = (CompilationSection) WebConfigurationManager.GetWebApplicationSection ("system.web/compilation");
|
||||
string tempdir = section.TempDirectory;
|
||||
if (String.IsNullOrEmpty (tempdir))
|
||||
tempdir = AppDomain.CurrentDomain.SetupInformation.DynamicBase;
|
||||
|
||||
@@ -434,7 +434,7 @@ namespace System.Web.Compilation
|
||||
protected void CreateProfileProperty ()
|
||||
{
|
||||
string retType;
|
||||
if (AppCodeCompiler.HaveCustomProfile (WebConfigurationManager.GetSection ("system.web/profile") as ProfileSection))
|
||||
if (AppCodeCompiler.HaveCustomProfile (WebConfigurationManager.GetWebApplicationSection ("system.web/profile") as ProfileSection))
|
||||
retType = "ProfileCommon";
|
||||
else
|
||||
retType = "System.Web.Profile.DefaultProfile";
|
||||
@@ -635,7 +635,7 @@ namespace System.Web.Compilation
|
||||
par = null;
|
||||
|
||||
#if NET_2_0
|
||||
CompilationSection config = (CompilationSection) WebConfigurationManager.GetSection ("system.web/compilation");
|
||||
CompilationSection config = (CompilationSection) WebConfigurationManager.GetWebApplicationSection ("system.web/compilation");
|
||||
Compiler comp = config.Compilers[lang];
|
||||
|
||||
if (comp == null) {
|
||||
|
||||
@@ -43,6 +43,7 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
using System.Web;
|
||||
using System.Web.Caching;
|
||||
using System.Web.Configuration;
|
||||
@@ -260,6 +261,8 @@ namespace System.Web.Compilation {
|
||||
const string BUILD_MANAGER_VIRTUAL_PATH_CACHE_PREFIX = "Build_Manager";
|
||||
static int BUILD_MANAGER_VIRTUAL_PATH_CACHE_PREFIX_LENGTH = BUILD_MANAGER_VIRTUAL_PATH_CACHE_PREFIX.Length;
|
||||
static bool hosted;
|
||||
static IEqualityComparer <string> comparer;
|
||||
|
||||
|
||||
static object buildCacheLock = new object ();
|
||||
|
||||
@@ -270,6 +273,8 @@ namespace System.Web.Compilation {
|
||||
//
|
||||
// static object buildCountLock = new object ();
|
||||
// static int buildCount = 0;
|
||||
static bool is_precompiled;
|
||||
static Dictionary<string, PreCompilationData> precompiled;
|
||||
|
||||
static List<Assembly> AppCode_Assemblies = new List<Assembly>();
|
||||
static List<Assembly> TopLevel_Assemblies = new List<Assembly>();
|
||||
@@ -316,8 +321,6 @@ namespace System.Web.Compilation {
|
||||
|
||||
static BuildManager ()
|
||||
{
|
||||
IEqualityComparer <string> comparer;
|
||||
|
||||
if (HttpRuntime.CaseInsensitive)
|
||||
comparer = StringComparer.CurrentCultureIgnoreCase;
|
||||
else
|
||||
@@ -328,6 +331,11 @@ namespace System.Web.Compilation {
|
||||
dependencyCache = new Dictionary <string, List <string>> (comparer);
|
||||
compilationTickets = new Dictionary <string, object> (comparer);
|
||||
hosted = (AppDomain.CurrentDomain.GetData (ApplicationHost.MonoHostedDataKey) as string) == "yes";
|
||||
|
||||
is_precompiled = File.Exists (Path.Combine (HttpRuntime.AppDomainAppPath, "PrecompiledApp.config"));
|
||||
if (is_precompiled) {
|
||||
LoadPrecompilationInfo ();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void ThrowNoProviderException (string extension)
|
||||
@@ -362,7 +370,7 @@ namespace System.Web.Compilation {
|
||||
{
|
||||
List <Assembly> al = new List <Assembly> ();
|
||||
|
||||
CompilationSection compConfig = WebConfigurationManager.GetSection ("system.web/compilation") as CompilationSection;
|
||||
CompilationSection compConfig = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
|
||||
if (compConfig == null)
|
||||
return al;
|
||||
|
||||
@@ -411,6 +419,57 @@ namespace System.Web.Compilation {
|
||||
AddAssembly (Assembly.Load (info.Assembly), al);
|
||||
}
|
||||
|
||||
static void LoadPrecompilationInfo ()
|
||||
{
|
||||
string [] compiled = Directory.GetFiles (HttpRuntime.BinDirectory, "*.compiled");
|
||||
foreach (string str in compiled) {
|
||||
LoadCompiled (str);
|
||||
}
|
||||
}
|
||||
|
||||
static void LoadCompiled (string filename)
|
||||
{
|
||||
using (XmlTextReader reader = new XmlTextReader (filename)) {
|
||||
reader.MoveToContent ();
|
||||
if (reader.Name == "preserve" && reader.HasAttributes) {
|
||||
reader.MoveToNextAttribute ();
|
||||
string val = reader.Value;
|
||||
// 2 -> ashx
|
||||
// 3 -> ascx, aspx
|
||||
// 6 -> app_code - nothing to do here
|
||||
// 8 -> global.asax
|
||||
// 9 -> App_GlobalResources - nothing to do?
|
||||
if (reader.Name == "resultType" && (val == "2" || val == "3" || val == "8"))
|
||||
LoadPageData (reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PreCompilationData {
|
||||
public string VirtualPath;
|
||||
public string AssemblyFileName;
|
||||
public string TypeName;
|
||||
public Type Type;
|
||||
}
|
||||
|
||||
static void LoadPageData (XmlTextReader reader)
|
||||
{
|
||||
PreCompilationData pc_data = new PreCompilationData ();
|
||||
|
||||
while (reader.MoveToNextAttribute ()) {
|
||||
string name = reader.Name;
|
||||
if (name == "virtualPath")
|
||||
pc_data.VirtualPath = reader.Value;
|
||||
else if (name == "assembly")
|
||||
pc_data.AssemblyFileName = reader.Value;
|
||||
else if (name == "type")
|
||||
pc_data.TypeName = reader.Value;
|
||||
}
|
||||
if (precompiled == null)
|
||||
precompiled = new Dictionary<string, PreCompilationData> (comparer);
|
||||
precompiled.Add (pc_data.VirtualPath, pc_data);
|
||||
}
|
||||
|
||||
static void AddAssembly (Assembly asm, List <Assembly> al)
|
||||
{
|
||||
if (al.Contains (asm))
|
||||
@@ -436,7 +495,7 @@ namespace System.Web.Compilation {
|
||||
CompilationSection c = section;
|
||||
|
||||
if (c == null)
|
||||
c = WebConfigurationManager.GetSection ("system.web/compilation", virtualPath.Original) as CompilationSection;
|
||||
c = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
|
||||
|
||||
if (c == null)
|
||||
if (throwOnMissing)
|
||||
@@ -488,10 +547,39 @@ namespace System.Web.Compilation {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
static Type GetPrecompiledType (string virtualPath)
|
||||
{
|
||||
PreCompilationData pc_data;
|
||||
if (precompiled.TryGetValue (virtualPath, out pc_data)) {
|
||||
if (pc_data.Type == null) {
|
||||
pc_data.Type = Type.GetType (pc_data.TypeName + ", " + pc_data.AssemblyFileName, true);
|
||||
}
|
||||
return pc_data.Type;
|
||||
}
|
||||
//Console.WriteLine ("VPath not precompiled: {0}", virtualPath);
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static Type GetPrecompiledApplicationType ()
|
||||
{
|
||||
if (!is_precompiled)
|
||||
return null;
|
||||
|
||||
Type apptype = GetPrecompiledType (HttpRuntime.AppDomainAppVirtualPath + "/Global.asax");
|
||||
if (apptype == null)
|
||||
apptype = GetPrecompiledType (HttpRuntime.AppDomainAppVirtualPath + "/global.asax");
|
||||
return apptype;
|
||||
}
|
||||
|
||||
public static Assembly GetCompiledAssembly (string virtualPath)
|
||||
{
|
||||
VirtualPath vp = GetAbsoluteVirtualPath (virtualPath);
|
||||
if (is_precompiled) {
|
||||
Type type = GetPrecompiledType (vp.Absolute);
|
||||
if (type != null)
|
||||
return type.Assembly;
|
||||
}
|
||||
BuildCacheItem ret = GetCachedItem (vp);
|
||||
if (ret != null)
|
||||
return ret.assembly;
|
||||
@@ -507,6 +595,12 @@ namespace System.Web.Compilation {
|
||||
public static Type GetCompiledType (string virtualPath)
|
||||
{
|
||||
VirtualPath vp = GetAbsoluteVirtualPath (virtualPath);
|
||||
if (is_precompiled) {
|
||||
Type type = GetPrecompiledType (vp.Absolute);
|
||||
if (type != null)
|
||||
return type;
|
||||
//TODO: What do we do here? Throw?
|
||||
}
|
||||
BuildCacheItem ret = GetCachedItem (vp);
|
||||
|
||||
if (ret != null)
|
||||
@@ -619,7 +713,7 @@ namespace System.Web.Compilation {
|
||||
|
||||
CompilationSection config;
|
||||
if (configSection == null)
|
||||
config = WebConfigurationManager.GetSection ("system.web/compilation") as CompilationSection;
|
||||
config = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
|
||||
else
|
||||
config = configSection;
|
||||
|
||||
@@ -671,8 +765,7 @@ namespace System.Web.Compilation {
|
||||
if (req == null)
|
||||
throw new HttpException ("No context available, cannot build.");
|
||||
|
||||
string vpAbsolute = virtualPath.Absolute;
|
||||
CompilationSection section = WebConfigurationManager.GetSection ("system.web/compilation", vpAbsolute) as CompilationSection;
|
||||
CompilationSection section = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
|
||||
List <VirtualFile> files;
|
||||
|
||||
try {
|
||||
@@ -1227,7 +1320,10 @@ namespace System.Web.Compilation {
|
||||
}
|
||||
|
||||
dep = new CacheDependency (files.ToArray ());
|
||||
dependencyCache.Add (virtualPath, files);
|
||||
if (dependencyCache.ContainsKey (virtualPath))
|
||||
dependencyCache [virtualPath] = files;
|
||||
else
|
||||
dependencyCache.Add (virtualPath, files);
|
||||
} else
|
||||
dep = null;
|
||||
|
||||
@@ -1395,7 +1491,7 @@ namespace System.Web.Compilation {
|
||||
}
|
||||
|
||||
internal static CompilationSection CompilationConfig {
|
||||
get { return WebConfigurationManager.GetSection ("system.web/compilation") as CompilationSection; }
|
||||
get { return WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace System.Web.Compilation {
|
||||
protected CompilerType GetDefaultCompilerType ()
|
||||
{
|
||||
CompilationSection config;
|
||||
config = (CompilationSection) WebConfigurationManager.GetSection ("system.web/compilation");
|
||||
config = (CompilationSection) WebConfigurationManager.GetWebApplicationSection ("system.web/compilation");
|
||||
return BuildManager.GetDefaultCompilerTypeForLanguage (config.DefaultLanguage, config);
|
||||
}
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace System.Web.Compilation
|
||||
}
|
||||
}
|
||||
|
||||
CompilationSection cfg = WebConfigurationManager.GetSection ("system.web/compilation") as CompilationSection;
|
||||
CompilationSection cfg = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
|
||||
AssemblyCollection asmcoll = cfg != null ? cfg.Assemblies : null;
|
||||
|
||||
if (asmcoll == null)
|
||||
|
||||
@@ -1,3 +1,99 @@
|
||||
2009-02-28 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* AppResourcesAssemblyBuilder.cs:
|
||||
* AspComponentFoundry.cs:
|
||||
* AssemblyBuilder.cs:
|
||||
* CachingCompiler.cs:
|
||||
* AspGenerator.cs:
|
||||
* WsdlBuildProvider.cs:
|
||||
* BaseCompiler.cs:
|
||||
* BuildProvider.cs:
|
||||
* AppWebReferencesCompiler.cs:
|
||||
* TemplateControlCompiler.cs:
|
||||
* BuildManager.cs:
|
||||
* AppCodeCompiler.cs: settings that have to be in
|
||||
machine.config or the root level web.config now call
|
||||
GetWebApplicationSection.
|
||||
|
||||
2009-02-26 Marek Habersack <[email protected]>
|
||||
|
||||
* TagAttributes.cs: modified ToString to return string formatted
|
||||
in a more helpful way.
|
||||
|
||||
* AspParser.cs: added ToString, helpful when debugging.
|
||||
|
||||
* AspGenerator.cs: properly print leading and trailing plain text
|
||||
when looking for embedded tags in ProcessTagsInAttributes.
|
||||
|
||||
2009-02-25 Marek Habersack <[email protected]>
|
||||
|
||||
* AspTokenizer.cs: put_back now uses a stack and allows more than
|
||||
one invocation when called inside a tag.
|
||||
|
||||
* AspGenerator.cs: when a nested parser is used, pay attention to
|
||||
server tags found inside client tags and add them to the control
|
||||
tree.
|
||||
|
||||
2009-02-20 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* BuildManager.cs: updated comment.
|
||||
|
||||
2009-02-18 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* TemplateControlCompiler.cs: lowercase place holder names
|
||||
* BuildManager.cs: initial support for precompiled sites.
|
||||
|
||||
2009-02-13 Marek Habersack <[email protected]>
|
||||
|
||||
* AspParser.cs: added an event raised when parsing is complete.
|
||||
|
||||
* AspGenerator.cs: added support for PageParserFilter which, if
|
||||
found, is used to control certain aspects of code parsing
|
||||
(accepting/rejecting control types, accepting/rejecting code
|
||||
snippets, parsing completion)
|
||||
Added the AddControl method, used by PageParserFilter when a
|
||||
custom filter wants to inject a control in the current control
|
||||
builder tree.
|
||||
|
||||
2009-02-05 Marek Habersack <[email protected]>
|
||||
|
||||
* AppResourcesCompiler.cs: implemented a type resolver for
|
||||
ResXResourceReader so that it can correctly resolve
|
||||
System.Resources types which are normally found in
|
||||
System.Windows.Forms but are included by System.Web
|
||||
directly. Without the type resolver, code comparing types inside
|
||||
ResXResourceReader when file references are used in side the .resx
|
||||
file will not work correctly. The reason for that is that .resx
|
||||
files will name "System.Resources.ResXFileRef,
|
||||
System.Windows.Forms" as the file reference handler, while inside
|
||||
System.Web ResXFileRef will be of type
|
||||
"System.Resources.ResXFileRef, System.Web". Fixes bug #466059
|
||||
|
||||
* GenericBuildProvider.cs: added a new virtual method, MapPath,
|
||||
which can be overriden by builders which need special handling of
|
||||
virtual path mapping.
|
||||
|
||||
* PageBuildProvider.cs: provide implementation of
|
||||
GenericBuildProvider.MapPath which takes into account fake virtual
|
||||
paths. Fixes bug #463950
|
||||
|
||||
2009-01-26 Marek Habersack <[email protected]>
|
||||
|
||||
* CompilationException.cs: added a Message override to make error
|
||||
messages more useful.
|
||||
|
||||
2009-01-23 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* AspComponentFoundry.cs: no need to throw. Caller handles a null
|
||||
return value.
|
||||
|
||||
2009-01-23 Marek Habersack <[email protected]>
|
||||
|
||||
* BuildManager.cs: if dependencyCache already contains the virtual
|
||||
path, replace its corresponding file set (in AddToCache). This can
|
||||
happen only if the requested virtual path compilation resulted in
|
||||
errors and the compilation has been retried. Fixes bug #462681
|
||||
|
||||
2009-01-14 Marek Habersack <[email protected]>
|
||||
|
||||
* AspGenerator.cs: implemented a work around which allows the
|
||||
|
||||
@@ -84,7 +84,11 @@ namespace System.Web.Compilation
|
||||
info.AddValue ("errmsg", errmsg);
|
||||
info.AddValue ("errorLines", errorLines);
|
||||
}
|
||||
|
||||
|
||||
public override string Message {
|
||||
get { return ErrorMessage; }
|
||||
}
|
||||
|
||||
public override string SourceFile {
|
||||
get {
|
||||
if (errors == null || errors.Count == 0)
|
||||
|
||||
@@ -58,6 +58,17 @@ namespace System.Web.Compilation
|
||||
protected abstract string GetClassType (BaseCompiler compiler, TParser parser);
|
||||
protected abstract AspGenerator CreateAspGenerator (TParser parser);
|
||||
protected abstract List <string> GetReferencedAssemblies (TParser parser);
|
||||
|
||||
protected virtual string MapPath (string virtualPath)
|
||||
{
|
||||
HttpContext ctx = HttpContext.Current;
|
||||
HttpRequest req = ctx != null ? ctx.Request : null;
|
||||
|
||||
if (req != null)
|
||||
return req.MapPath (VirtualPath);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
protected virtual TParser Parse ()
|
||||
{
|
||||
@@ -68,18 +79,9 @@ namespace System.Web.Compilation
|
||||
|
||||
if (!IsDirectoryBuilder) {
|
||||
AspGenerator generator = CreateAspGenerator (parser);
|
||||
if (_reader != null) {
|
||||
HttpContext ctx = HttpContext.Current;
|
||||
HttpRequest req = ctx != null ? ctx.Request : null;
|
||||
string filename;
|
||||
|
||||
if (req != null)
|
||||
filename = req.MapPath (VirtualPath);
|
||||
else
|
||||
filename = null;
|
||||
|
||||
generator.Parse (_reader, filename, true);
|
||||
} else
|
||||
if (_reader != null)
|
||||
generator.Parse (_reader, MapPath (VirtualPath), true);
|
||||
else
|
||||
generator.Parse ();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,15 @@ namespace System.Web.Compilation {
|
||||
{
|
||||
}
|
||||
|
||||
protected override string MapPath (string virtualPath)
|
||||
{
|
||||
// We need this hack to support out-of-application wsdl helpers
|
||||
if (StrUtils.StartsWith (virtualPath, BuildManager.FAKE_VIRTUAL_PATH_PREFIX))
|
||||
return virtualPath.Substring (BuildManager.FAKE_VIRTUAL_PATH_PREFIX.Length);
|
||||
|
||||
return base.MapPath (virtualPath);
|
||||
}
|
||||
|
||||
protected override TextReader SpecialOpenReader (string virtualPath, out string physicalPath)
|
||||
{
|
||||
// We need this hack to support out-of-application wsdl helpers
|
||||
|
||||
@@ -180,20 +180,22 @@ namespace System.Web.Compilation
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
StringBuilder result = new StringBuilder ();
|
||||
StringBuilder result = new StringBuilder ("TagAttributes {");
|
||||
string value;
|
||||
foreach (string key in Keys){
|
||||
result.Append ('[');
|
||||
result.Append (key);
|
||||
value = this [key] as string;
|
||||
if (value != null)
|
||||
result.AppendFormat ("=\"{0}\"", value);
|
||||
|
||||
result.Append (' ');
|
||||
result.Append ("] ");
|
||||
}
|
||||
|
||||
if (result.Length > 0 && result [result.Length - 1] == ' ')
|
||||
result.Length--;
|
||||
|
||||
|
||||
result.Append ('}');
|
||||
return result.ToString ();
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 376 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user