mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 11:21:08 -10:00
Compare commits
107
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7c906d69a | ||
|
|
74c2f25e09 | ||
|
|
993619335e | ||
|
|
cae23899bb | ||
|
|
0f49530f57 | ||
|
|
79104a822c | ||
|
|
3d850b4910 | ||
|
|
9845767781 | ||
|
|
e7c5382bd4 | ||
|
|
b5176c872f | ||
|
|
03ae840b32 | ||
|
|
b4d21c56d2 | ||
|
|
c38a76f099 | ||
|
|
d3354bb159 | ||
|
|
9392f2a948 | ||
|
|
c31c2c4fd1 | ||
|
|
cefb81a61a | ||
|
|
0e3db756cb | ||
|
|
0db73758fd | ||
|
|
496c48aca4 | ||
|
|
b4141c1424 | ||
|
|
d7af72d54d | ||
|
|
2d5b1cef66 | ||
|
|
81ef55164d | ||
|
|
49a1bc1538 | ||
|
|
589e940bc6 | ||
|
|
c5d7220d6a | ||
|
|
ea07ea7bec | ||
|
|
f7f33d6f2b | ||
|
|
12e67c4ff7 | ||
|
|
05a7cf58c2 | ||
|
|
f96a350b60 | ||
|
|
0a71bff0b3 | ||
|
|
d3e46d99d7 | ||
|
|
957241f9ec | ||
|
|
09f45b93ed | ||
|
|
39f1634174 | ||
|
|
7af66d460c | ||
|
|
f383918650 | ||
|
|
c17025679b | ||
|
|
79da167e9d | ||
|
|
3c3ce70a10 | ||
|
|
890b31f194 | ||
|
|
31b68946ed | ||
|
|
9eca320524 | ||
|
|
8d18a952b9 | ||
|
|
dc3a015732 | ||
|
|
2475362492 | ||
|
|
f88b860df8 | ||
|
|
55aebc3466 | ||
|
|
aa10117a44 | ||
|
|
beced60068 | ||
|
|
4b37876e03 | ||
|
|
9ca9ca133d | ||
|
|
5d07cad031 | ||
|
|
9e9fd66eda | ||
|
|
4741aa56d1 | ||
|
|
42a4728db1 | ||
|
|
78cd253527 | ||
|
|
879dec8ca6 | ||
|
|
dbccda700b | ||
|
|
57afb9bff1 | ||
|
|
61b04ac56d | ||
|
|
7d6aa1e322 | ||
|
|
db66ea05c0 | ||
|
|
43e34e9221 | ||
|
|
69154db126 | ||
|
|
1f7a1c183c | ||
|
|
beb7543392 | ||
|
|
d0dbad9ad7 | ||
|
|
4f8c33af39 | ||
|
|
90c46b9308 | ||
|
|
8082e15625 | ||
|
|
58864d7fca | ||
|
|
c79c91c80c | ||
|
|
8973515d9d | ||
|
|
9346c56300 | ||
|
|
5a4e4d261b | ||
|
|
259bc42379 | ||
|
|
9b28a1de73 | ||
|
|
1eb27e1f63 | ||
|
|
7edb572581 | ||
|
|
364a5d0b74 | ||
|
|
3aa9628276 | ||
|
|
bcc8b6fb2d | ||
|
|
eefca1d2f0 | ||
|
|
075b2246c4 | ||
|
|
70390d5989 | ||
|
|
08a3283160 | ||
|
|
f65e2f5bde | ||
|
|
89a11d5206 | ||
|
|
cd1791a956 | ||
|
|
06bce6170a | ||
|
|
6eb53dd31a | ||
|
|
329316a6c6 | ||
|
|
cb768e733f | ||
|
|
d1973e174d | ||
|
|
fd3fd2455f | ||
|
|
7944cbd726 | ||
|
|
ef0ea82263 | ||
|
|
2de8607599 | ||
|
|
ca5715e665 | ||
|
|
774fd03e78 | ||
|
|
8b8d58705b | ||
|
|
c5cbb9cb4b | ||
|
|
95ab6bc64d | ||
|
|
2403930b66 |
No files matched your search
@@ -1,3 +1,7 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* mono-core.spec.in: Add Microsoft.WebApplication.targets
|
||||
|
||||
2009-08-29 Jonathan Pryor <[email protected]>
|
||||
|
||||
* man/mdoc-export-html.1: Document --with-profile, --with-version.
|
||||
|
||||
+1
-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.5)
|
||||
AM_INIT_AUTOMAKE(mono,2.6)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
API_VER=1.0
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2009-09-26 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* test/queue.c: new tests.
|
||||
* src/gqueue.c: fixed pop_head.
|
||||
|
||||
2009-09-26 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* src/gqueue.c: add g_queue_push_tail.
|
||||
|
||||
2009-06-20 Zoltan Varga <[email protected]>
|
||||
|
||||
* src/glib.h: Add GUINT32_FROM/TO_BE macros.
|
||||
|
||||
@@ -469,6 +469,8 @@ typedef struct {
|
||||
gpointer g_queue_pop_head (GQueue *queue);
|
||||
void g_queue_push_head (GQueue *queue,
|
||||
gpointer data);
|
||||
void g_queue_push_tail (GQueue *queue,
|
||||
gpointer data);
|
||||
gboolean g_queue_is_empty (GQueue *queue);
|
||||
GQueue *g_queue_new (void);
|
||||
void g_queue_free (GQueue *queue);
|
||||
|
||||
+31
-15
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Author:
|
||||
* Duncan Mak ([email protected])
|
||||
* Gonzalo Paniagua Javier ([email protected])
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -23,7 +24,7 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
* Copyright (c) 2006-2009 Novell, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -33,19 +34,23 @@
|
||||
gpointer
|
||||
g_queue_pop_head (GQueue *queue)
|
||||
{
|
||||
gpointer head = NULL;
|
||||
gpointer result;
|
||||
GList *old_head;
|
||||
|
||||
if (queue->length != 0){
|
||||
GList *old_head;
|
||||
if (!queue || queue->length == 0)
|
||||
return NULL;
|
||||
|
||||
old_head = queue->head;
|
||||
head = old_head->data;
|
||||
queue->head = old_head->next;
|
||||
queue->length--;
|
||||
g_list_free_1 (old_head);
|
||||
}
|
||||
result = queue->head->data;
|
||||
old_head = queue->head;
|
||||
queue->head = old_head->next;
|
||||
g_list_free_1 (old_head);
|
||||
|
||||
return head;
|
||||
if (--queue->length)
|
||||
queue->head->prev = NULL;
|
||||
else
|
||||
queue->tail = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -71,13 +76,24 @@ g_queue_push_head (GQueue *queue, gpointer head)
|
||||
queue->length ++;
|
||||
}
|
||||
|
||||
void
|
||||
g_queue_push_tail (GQueue *queue, gpointer data)
|
||||
{
|
||||
if (!queue)
|
||||
return;
|
||||
|
||||
queue->tail = g_list_append (queue->tail, data);
|
||||
if (queue->head == NULL)
|
||||
queue->head = queue->tail;
|
||||
else
|
||||
queue->tail = queue->tail->next;
|
||||
queue->length++;
|
||||
}
|
||||
|
||||
GQueue *
|
||||
g_queue_new (void)
|
||||
{
|
||||
GQueue *queue = g_new0 (GQueue, 1);
|
||||
queue->length = 0;
|
||||
|
||||
return queue;
|
||||
return g_new0 (GQueue, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -15,6 +15,66 @@ test_queue_push ()
|
||||
if (queue->length != 3)
|
||||
return FAILED ("push failed");
|
||||
|
||||
if (NULL != queue->head->prev)
|
||||
return FAILED ("HEAD: prev is wrong");
|
||||
if (strcmp ("baz", queue->head->data))
|
||||
return FAILED ("HEAD: First element is wrong");
|
||||
if (strcmp ("bar", queue->head->next->data))
|
||||
return FAILED ("HEAD: Second element is wrong");
|
||||
if (strcmp ("foo", queue->head->next->next->data))
|
||||
return FAILED ("HEAD: Third element is wrong");
|
||||
if (NULL != queue->head->next->next->next)
|
||||
return FAILED ("HEAD: End is wrong");
|
||||
|
||||
if (NULL != queue->tail->next)
|
||||
return FAILED ("TAIL: next is wrong");
|
||||
if (strcmp ("foo", queue->tail->data))
|
||||
return FAILED ("TAIL: Third element is wrong");
|
||||
if (strcmp ("bar", queue->tail->prev->data))
|
||||
return FAILED ("TAIL: Second element is wrong");
|
||||
if (strcmp ("baz", queue->tail->prev->prev->data))
|
||||
return FAILED ("TAIL: First element is wrong");
|
||||
if (NULL != queue->tail->prev->prev->prev)
|
||||
return FAILED ("TAIL: End is wrong");
|
||||
|
||||
g_queue_free (queue);
|
||||
return OK;
|
||||
}
|
||||
|
||||
RESULT
|
||||
test_queue_push_tail ()
|
||||
{
|
||||
GQueue *queue = g_queue_new ();
|
||||
|
||||
g_queue_push_tail (queue, "baz");
|
||||
g_queue_push_tail (queue, "bar");
|
||||
g_queue_push_tail (queue, "foo");
|
||||
|
||||
if (queue->length != 3)
|
||||
return FAILED ("push failed");
|
||||
|
||||
if (NULL != queue->head->prev)
|
||||
return FAILED ("HEAD: prev is wrong");
|
||||
if (strcmp ("baz", queue->head->data))
|
||||
return FAILED ("HEAD: First element is wrong");
|
||||
if (strcmp ("bar", queue->head->next->data))
|
||||
return FAILED ("HEAD: Second element is wrong");
|
||||
if (strcmp ("foo", queue->head->next->next->data))
|
||||
return FAILED ("HEAD: Third element is wrong");
|
||||
if (NULL != queue->head->next->next->next)
|
||||
return FAILED ("HEAD: End is wrong");
|
||||
|
||||
if (NULL != queue->tail->next)
|
||||
return FAILED ("TAIL: next is wrong");
|
||||
if (strcmp ("foo", queue->tail->data))
|
||||
return FAILED ("TAIL: Third element is wrong");
|
||||
if (strcmp ("bar", queue->tail->prev->data))
|
||||
return FAILED ("TAIL: Second element is wrong");
|
||||
if (strcmp ("baz", queue->tail->prev->prev->data))
|
||||
return FAILED ("TAIL: First element is wrong");
|
||||
if (NULL != queue->tail->prev->prev->prev)
|
||||
return FAILED ("TAIL: End is wrong");
|
||||
|
||||
g_queue_free (queue);
|
||||
return OK;
|
||||
}
|
||||
@@ -47,6 +107,30 @@ test_queue_pop ()
|
||||
if (queue->length != 0)
|
||||
return FAILED ("expect 0 length .");
|
||||
|
||||
g_queue_push_head (queue, "foo");
|
||||
g_queue_push_head (queue, "bar");
|
||||
g_queue_push_head (queue, "baz");
|
||||
|
||||
g_queue_pop_head (queue);
|
||||
|
||||
if (NULL != queue->head->prev)
|
||||
return FAILED ("HEAD: prev is wrong");
|
||||
if (strcmp ("bar", queue->head->data))
|
||||
return FAILED ("HEAD: Second element is wrong");
|
||||
if (strcmp ("foo", queue->head->next->data))
|
||||
return FAILED ("HEAD: Third element is wrong");
|
||||
if (NULL != queue->head->next->next)
|
||||
return FAILED ("HEAD: End is wrong");
|
||||
|
||||
if (NULL != queue->tail->next)
|
||||
return FAILED ("TAIL: next is wrong");
|
||||
if (strcmp ("foo", queue->tail->data))
|
||||
return FAILED ("TAIL: Second element is wrong");
|
||||
if (strcmp ("bar", queue->tail->prev->data))
|
||||
return FAILED ("TAIL: First element is wrong");
|
||||
if (NULL != queue->tail->prev->prev)
|
||||
return FAILED ("TAIL: End is wrong");
|
||||
|
||||
g_queue_free (queue);
|
||||
return OK;
|
||||
}
|
||||
@@ -89,6 +173,7 @@ test_queue_is_empty ()
|
||||
|
||||
static Test queue_tests [] = {
|
||||
{ "push", test_queue_push},
|
||||
{"push_tail", test_queue_push_tail},
|
||||
{ "pop", test_queue_pop},
|
||||
{ "new", test_queue_new},
|
||||
{"is_empty", test_queue_is_empty},
|
||||
|
||||
+5
-9
@@ -1,15 +1,11 @@
|
||||
2009-09-24 Marek Safar <marek.safar@gmail.com>
|
||||
2009-10-14 Jonathan Pryor <jpryor@novell.com>
|
||||
|
||||
* Makefile: Removed System.Json from net_4_0 profile.
|
||||
* Makefile: Add Mono.Data.Tds, System.Transactions, System.Data, and
|
||||
Mono.Data.Sqlite to the MonoTouch build.
|
||||
|
||||
2009-09-17 Atsushi Enomoto <atsushi@ximian.com>
|
||||
2009-10-08 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* Makefile: move core WCF assemblies before Sys.Web.Extensions,
|
||||
which will depend on them.
|
||||
|
||||
2009-09-11 Marek Safar <[email protected]>
|
||||
|
||||
* Makefile: Add System.Core to net_4_0_boostrap.
|
||||
* Makefile: build the i18n assemblies on MonoTouch.
|
||||
|
||||
2009-09-02 Jb Evain <[email protected]>
|
||||
|
||||
|
||||
+17
-7
@@ -29,8 +29,6 @@ common_dirs := \
|
||||
System \
|
||||
System.XML \
|
||||
Mono.CompilerServices.SymbolWriter \
|
||||
Mono.Posix \
|
||||
System.Core \
|
||||
Mono.Security \
|
||||
System \
|
||||
System.Security \
|
||||
@@ -45,6 +43,7 @@ common_dirs := \
|
||||
System.Data \
|
||||
Mono.Data \
|
||||
Mono.GetOptions \
|
||||
Mono.Posix \
|
||||
Accessibility \
|
||||
Mono.WebBrowser \
|
||||
Managed.Windows.Forms \
|
||||
@@ -99,6 +98,7 @@ net_2_0_dirs := \
|
||||
Microsoft.Build.Framework \
|
||||
Microsoft.Build.Utilities \
|
||||
Microsoft.Build.Engine \
|
||||
System.Core \
|
||||
Microsoft.Build.Tasks \
|
||||
System.Xml.Linq \
|
||||
System.Runtime.Serialization \
|
||||
@@ -107,13 +107,13 @@ net_2_0_dirs := \
|
||||
System.Web \
|
||||
System.Web.Abstractions \
|
||||
System.Web.Routing \
|
||||
System.IdentityModel \
|
||||
System.IdentityModel.Selectors \
|
||||
System.ServiceModel \
|
||||
System.Web.Extensions \
|
||||
System.Web.Extensions.Design \
|
||||
System.ComponentModel.DataAnnotations \
|
||||
System.Web.DynamicData \
|
||||
System.IdentityModel \
|
||||
System.IdentityModel.Selectors \
|
||||
System.ServiceModel \
|
||||
System.ServiceModel.Web \
|
||||
System.Web.Mvc \
|
||||
Mono.C5 \
|
||||
@@ -146,9 +146,18 @@ monotouch_dirs := \
|
||||
System.XML \
|
||||
Mono.Security \
|
||||
System \
|
||||
I18N \
|
||||
System.Core \
|
||||
System.Json \
|
||||
System.Xml.Linq
|
||||
System.Xml.Linq \
|
||||
System.Runtime.Serialization \
|
||||
System.ServiceModel \
|
||||
System.ServiceModel.Web \
|
||||
System.Web.Services \
|
||||
Mono.Data.Tds \
|
||||
System.Transactions \
|
||||
System.Data \
|
||||
Mono.Data.Sqlite
|
||||
|
||||
net_3_5_dirs := \
|
||||
Microsoft.Build.Framework \
|
||||
@@ -159,6 +168,7 @@ net_3_5_dirs := \
|
||||
|
||||
net_4_0_dirs := \
|
||||
System.Dynamic \
|
||||
System.Json \
|
||||
Microsoft.CSharp
|
||||
|
||||
net_1_1_bootstrap_SUBDIRS := $(bootstrap_dirs) PEAPI
|
||||
@@ -169,7 +179,7 @@ net_2_1_bootstrap_SUBDIRS := corlib System Mono.CompilerServices.SymbolWriter
|
||||
net_2_1_raw_SUBDIRS := $(net_2_1_dirs)
|
||||
monotouch_SUBDIRS := $(monotouch_dirs)
|
||||
net_3_5_SUBDIRS := $(net_3_5_dirs)
|
||||
net_4_0_bootstrap_SUBDIRS := $(bootstrap_dirs) PEAPI Mono.Posix System.Core
|
||||
net_4_0_bootstrap_SUBDIRS := $(bootstrap_dirs) PEAPI
|
||||
net_4_0_SUBDIRS := $(common_dirs) $(net_2_0_dirs) $(net_4_0_dirs)
|
||||
|
||||
include ../build/rules.make
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
GroupingCollection parentCollection;
|
||||
Project parentProject;
|
||||
bool read_only;
|
||||
bool evaluated;
|
||||
|
||||
public BuildItemGroup ()
|
||||
: this (null, null, null, false)
|
||||
@@ -237,6 +238,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
internal void Evaluate ()
|
||||
{
|
||||
if (evaluated)
|
||||
return;
|
||||
foreach (BuildItem bi in buildItems) {
|
||||
if (bi.Condition == String.Empty)
|
||||
bi.Evaluate (parentProject, true);
|
||||
@@ -245,6 +248,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
bi.Evaluate (parentProject, ce.BoolEvaluate (parentProject));
|
||||
}
|
||||
}
|
||||
evaluated = true;
|
||||
}
|
||||
|
||||
internal void ReplaceWith (BuildItem item, List <BuildItem> list)
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
Project parentProject;
|
||||
List <BuildProperty> properties;
|
||||
Dictionary <string, BuildProperty> propertiesByName;
|
||||
bool evaluated;
|
||||
|
||||
public BuildPropertyGroup ()
|
||||
: this (null, null, null, false)
|
||||
@@ -221,9 +222,14 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
internal void Evaluate ()
|
||||
{
|
||||
if (evaluated)
|
||||
return;
|
||||
|
||||
foreach (BuildProperty bp in properties)
|
||||
if (ConditionParser.ParseAndEvaluate (bp.Condition, parentProject))
|
||||
bp.Evaluate ();
|
||||
|
||||
evaluated = true;
|
||||
}
|
||||
|
||||
public string Condition {
|
||||
|
||||
@@ -1,3 +1,45 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* GroupingCollection.cs (Evaluate): Mark internal.
|
||||
* Project.cs (AddImport): Only evaluate the properties,
|
||||
till before the import.
|
||||
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* Project.cs (DoLoad): Don't use XmlReader.Create, for loading
|
||||
the project xml, as returned Xml*Reader normalizes the newlines.
|
||||
Instead directly use the TextReader with XmlDocument.Load ().
|
||||
|
||||
2009-09-27 Ankit Jain <[email protected]>
|
||||
|
||||
* ConditionParser.cs: Show the condition being parsed in the
|
||||
exception message.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* Expression.cs: Allow '-' in item, property and metadata names.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* Project.cs (Evaluate): Split into this and ..
|
||||
(PrepareForEvaluate): .. this.
|
||||
(AddImport): Evaluate the current set of properties/items etc,
|
||||
before processing the imported project. Honor the Condition
|
||||
for the Import.
|
||||
(ProcessProjectAttributes): Update MSBuildProjectDefaultTargets
|
||||
property.
|
||||
* GroupingCollection.cs (Evaluate): Don't evaluate Imports here.
|
||||
* BuildItemGroup.cs (Evaluate): Evaluate only once.
|
||||
* BuildPropertyGroup.cs (Evaluate): Evaluate only once.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* Project.cs: Get InitialTargets from the imported projects also.
|
||||
The combined list of targets are executed, in the order they were
|
||||
found.
|
||||
DefaultTargets are also read in from imported projects, and the first
|
||||
non-empty DefaultTargets found is used.
|
||||
|
||||
2009-09-25 Ankit Jain <[email protected]>
|
||||
|
||||
* Project.cs (BuildTarget): Handle skipped targets.
|
||||
|
||||
@@ -39,11 +39,13 @@ namespace Microsoft.Build.BuildEngine {
|
||||
internal class ConditionParser {
|
||||
|
||||
ConditionTokenizer tokenizer;
|
||||
string conditionStr;
|
||||
|
||||
ConditionParser (string condition)
|
||||
{
|
||||
tokenizer = new ConditionTokenizer ();
|
||||
tokenizer.Tokenize (condition);
|
||||
conditionStr = condition;
|
||||
}
|
||||
|
||||
public static bool ParseAndEvaluate (string condition, Project context)
|
||||
@@ -171,7 +173,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
} else if (token.Type == TokenType.Not) {
|
||||
e = ParseNotExpression ();
|
||||
} else
|
||||
throw new ExpressionParseException (String.Format ("Unexpected token type {0}.", token.Type));
|
||||
throw new ExpressionParseException (String.Format ("Unexpected token type {0}, while parsing {1}", token.Type, conditionStr));
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -244,7 +246,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
{
|
||||
if (tokenizer.Token.Type != type)
|
||||
throw new ExpressionParseException ("Expected token type of type: " + type + ", got " +
|
||||
tokenizer.Token.Type + " (" + tokenizer.Token.Value + ") .");
|
||||
tokenizer.Token.Type + " (" + tokenizer.Token.Value + "), while parsing " + conditionStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (item_regex == null)
|
||||
item_regex = new Regex (
|
||||
@"@\(\s*"
|
||||
+ @"(?<itemname>[_A-Za-z][_0-9a-zA-Z]*)"
|
||||
+ @"(?<itemname>[_A-Za-z][_\-0-9a-zA-Z]*)"
|
||||
+ @"(?<has_transform>\s*->\s*'(?<transform>[^']*)')?"
|
||||
+ @"(?<has_separator>\s*,\s*'(?<separator>[^']*)')?"
|
||||
+ @"\s*\)");
|
||||
@@ -312,7 +312,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (property_regex == null)
|
||||
property_regex = new Regex (
|
||||
@"\$\(\s*"
|
||||
+ @"(?<name>[_a-zA-Z][_0-9a-zA-Z]*)"
|
||||
+ @"(?<name>[_a-zA-Z][_\-0-9a-zA-Z]*)"
|
||||
+ @"\s*\)");
|
||||
return property_regex;
|
||||
}
|
||||
@@ -323,8 +323,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (metadata_regex == null)
|
||||
metadata_regex = new Regex (
|
||||
@"%\(\s*"
|
||||
+ @"((?<name>[_a-zA-Z][_0-9a-zA-Z]*)\.)?"
|
||||
+ @"(?<meta>[_a-zA-Z][_0-9a-zA-Z]*)"
|
||||
+ @"((?<name>[_a-zA-Z][_\-0-9a-zA-Z]*)\.)?"
|
||||
+ @"(?<meta>[_a-zA-Z][_\-0-9a-zA-Z]*)"
|
||||
+ @"\s*\)");
|
||||
return metadata_regex;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
Evaluate (EvaluationType.Choose);
|
||||
}
|
||||
|
||||
void Evaluate (EvaluationType type)
|
||||
internal void Evaluate (EvaluationType type)
|
||||
{
|
||||
BuildItemGroup big;
|
||||
BuildPropertyGroup bpg;
|
||||
@@ -183,10 +183,6 @@ namespace Microsoft.Build.BuildEngine {
|
||||
bpg = (BuildPropertyGroup) evaluate_iterator.Value;
|
||||
if (ConditionParser.ParseAndEvaluate (bpg.Condition, project))
|
||||
bpg.Evaluate ();
|
||||
} else if (evaluate_iterator.Value is Import) {
|
||||
import = (Import) evaluate_iterator.Value;
|
||||
if (ConditionParser.ParseAndEvaluate (import.Condition, project))
|
||||
import.Evaluate ();
|
||||
}
|
||||
|
||||
// if it wasn't moved by adding anything because of evaluating a Import shift it
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
bool isValidated;
|
||||
BuildItemGroupCollection itemGroups;
|
||||
ImportCollection imports;
|
||||
string[] initialTargets;
|
||||
List<string> initialTargets;
|
||||
Dictionary <string, BuildItemGroup> last_item_group_containing;
|
||||
bool needToReevaluate;
|
||||
Engine parentEngine;
|
||||
@@ -101,6 +101,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
current_settings = BuildSettings.None;
|
||||
|
||||
builtTargetKeys = new List<string> ();
|
||||
initialTargets = new List<string> ();
|
||||
defaultTargets = new string [0];
|
||||
|
||||
globalProperties = new BuildPropertyGroup (null, this, null, false);
|
||||
foreach (BuildProperty bp in parentEngine.GlobalProperties)
|
||||
@@ -298,7 +300,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!initialTargetsBuilt && initialTargets != null && initialTargets.Length > 0) {
|
||||
if (!initialTargetsBuilt) {
|
||||
foreach (string target in initialTargets) {
|
||||
if (!BuildTarget (target.Trim (), targetOutputs))
|
||||
return false;
|
||||
@@ -707,16 +709,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
try {
|
||||
ParentEngine.RemoveLoadedProject (this);
|
||||
|
||||
XmlReaderSettings settings = new XmlReaderSettings ();
|
||||
|
||||
if (SchemaFile != null) {
|
||||
settings.Schemas.Add (null, SchemaFile);
|
||||
settings.ValidationType = ValidationType.Schema;
|
||||
settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
|
||||
}
|
||||
|
||||
XmlReader xmlReader = XmlReader.Create (textReader, settings);
|
||||
xmlDocument.Load (xmlReader);
|
||||
xmlDocument.Load (textReader);
|
||||
|
||||
if (xmlDocument.DocumentElement.Name == "VisualStudioProject")
|
||||
throw new InvalidProjectFileException (String.Format (
|
||||
@@ -724,6 +717,12 @@ namespace Microsoft.Build.BuildEngine {
|
||||
"supported by xbuild. You need to convert it to msbuild " +
|
||||
"format to build with xbuild.", fullFileName));
|
||||
|
||||
if (SchemaFile != null) {
|
||||
xmlDocument.Schemas.Add (XmlSchema.Read (
|
||||
new StreamReader (SchemaFile), ValidationCallBack));
|
||||
xmlDocument.Validate (ValidationCallBack);
|
||||
}
|
||||
|
||||
if (xmlDocument.DocumentElement.Name != "Project") {
|
||||
throw new InvalidProjectFileException (String.Format (
|
||||
"The element <{0}> is unrecognized, or not supported in this context.", xmlDocument.DocumentElement.Name));
|
||||
@@ -766,12 +765,9 @@ namespace Microsoft.Build.BuildEngine {
|
||||
if (ParentEngine.DefaultTasksRegistered)
|
||||
taskDatabase.CopyTasks (ParentEngine.DefaultTasks);
|
||||
|
||||
if (xmlDocument.DocumentElement.GetAttributeNode ("DefaultTargets") != null)
|
||||
defaultTargets = xmlDocument.DocumentElement.GetAttribute ("DefaultTargets").Split (';');
|
||||
else
|
||||
defaultTargets = new string [0];
|
||||
|
||||
ProcessProjectAttributes (xmlDocument.DocumentElement.Attributes);
|
||||
initialTargets = new List<string> ();
|
||||
defaultTargets = new string [0];
|
||||
PrepareForEvaluate ();
|
||||
ProcessElements (xmlDocument.DocumentElement, null);
|
||||
|
||||
isDirty = false;
|
||||
@@ -783,12 +779,17 @@ namespace Microsoft.Build.BuildEngine {
|
||||
foreach (XmlAttribute attr in attributes) {
|
||||
switch (attr.Name) {
|
||||
case "InitialTargets":
|
||||
initialTargets = attr.Value.Split (new char [] {';'},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
initialTargets.AddRange (attr.Value.Split (
|
||||
new char [] {';', ' '},
|
||||
StringSplitOptions.RemoveEmptyEntries));
|
||||
break;
|
||||
case "DefaultTargets":
|
||||
defaultTargets = attr.Value.Split (new char [] {';'},
|
||||
// first non-empty DefaultTargets found is used
|
||||
if (defaultTargets == null || defaultTargets.Length == 0)
|
||||
defaultTargets = attr.Value.Split (new char [] {';', ' '},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDefaultTargets",
|
||||
DefaultTargets, PropertyType.Reserved));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -796,6 +797,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
internal void ProcessElements (XmlElement rootElement, ImportedProject ip)
|
||||
{
|
||||
ProcessProjectAttributes (rootElement.Attributes);
|
||||
foreach (XmlNode xn in rootElement.ChildNodes) {
|
||||
if (xn is XmlElement) {
|
||||
XmlElement xe = (XmlElement) xn;
|
||||
@@ -833,7 +835,7 @@ namespace Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
void Evaluate ()
|
||||
void PrepareForEvaluate ()
|
||||
{
|
||||
evaluatedItems = new BuildItemGroup (null, this, null, true);
|
||||
evaluatedItemsIgnoringCondition = new BuildItemGroup (null, this, null, true);
|
||||
@@ -843,7 +845,10 @@ namespace Microsoft.Build.BuildEngine {
|
||||
RemoveBuiltTargets ();
|
||||
|
||||
InitializeProperties ();
|
||||
}
|
||||
|
||||
void Evaluate ()
|
||||
{
|
||||
groupingCollection.Evaluate ();
|
||||
|
||||
//FIXME: UsingTasks aren't really evaluated. (shouldn't use expressions or anything)
|
||||
@@ -933,10 +938,14 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
void AddImport (XmlElement xmlElement, ImportedProject importingProject)
|
||||
{
|
||||
Import import;
|
||||
|
||||
import = new Import (xmlElement, this, importingProject);
|
||||
// eval all the properties etc till the import
|
||||
groupingCollection.Evaluate (EvaluationType.Property);
|
||||
|
||||
Import import = new Import (xmlElement, this, importingProject);
|
||||
Imports.Add (import);
|
||||
|
||||
if (ConditionParser.ParseAndEvaluate (import.Condition, this))
|
||||
import.Evaluate ();
|
||||
}
|
||||
|
||||
void AddItemGroup (XmlElement xmlElement, ImportedProject importedProject)
|
||||
@@ -978,11 +987,13 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
public string DefaultTargets {
|
||||
get {
|
||||
return xmlDocument.DocumentElement.GetAttribute ("DefaultTargets");
|
||||
return String.Join ("; ", defaultTargets);
|
||||
}
|
||||
set {
|
||||
xmlDocument.DocumentElement.SetAttribute ("DefaultTargets", value);
|
||||
defaultTargets = value.Split (new char [] {';'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (value != null)
|
||||
defaultTargets = value.Split (new char [] {';', ' '},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1177,11 +1188,14 @@ namespace Microsoft.Build.BuildEngine {
|
||||
|
||||
public string InitialTargets {
|
||||
get {
|
||||
return xmlDocument.DocumentElement.GetAttribute ("InitialTargets");
|
||||
return String.Join ("; ", initialTargets.ToArray ());
|
||||
}
|
||||
set {
|
||||
initialTargets.Clear ();
|
||||
xmlDocument.DocumentElement.SetAttribute ("InitialTargets", value);
|
||||
initialTargets = value.Split (new char [] {';'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (value != null)
|
||||
initialTargets.AddRange (value.Split (
|
||||
new char [] {';', ' '}, StringSplitOptions.RemoveEmptyEntries));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* ProjectTest.cs (TestPropertiesFromImportedProjects): New.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* TargetTest.cs (TestOverridingTargets): New.
|
||||
|
||||
2009-09-26 Ankit Jain <[email protected]>
|
||||
|
||||
* ProjectTest.cs (TestInitialTargetsWithImports):
|
||||
(TestDefaultTargets):
|
||||
(TestDefaultTargetsWithImports):
|
||||
(TestNoDefaultTargetsWithImports):
|
||||
(TestNoDefaultTargets): New tests.
|
||||
|
||||
2009-08-29 Ankit Jain <[email protected]>
|
||||
|
||||
* BuildItemTest.cs (TestSetMetadata5a): New.
|
||||
|
||||
@@ -1514,15 +1514,282 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
Assert.AreEqual (0, logger.CheckHead ("Executing pre target", MessageImportance.Normal), "A1");
|
||||
Assert.AreEqual (0, logger.CheckHead ("Executing boo target", MessageImportance.Normal), "A2");
|
||||
Assert.AreEqual (0, logger.Count, "A3");
|
||||
logger.CheckLoggedMessageHead ("Executing pre target", "A1");
|
||||
logger.CheckLoggedMessageHead ("Executing boo target", "A2");
|
||||
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInitialTargetsWithImports () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" InitialTargets=""One "">
|
||||
<Target Name=""One"">
|
||||
<Message Text='Executing Second::One target'/>
|
||||
</Target>
|
||||
<Import Project='third.proj'/>
|
||||
</Project>
|
||||
";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" InitialTargets=""Two"">
|
||||
<Target Name=""Two"">
|
||||
<Message Text='Executing Third::Two target'/>
|
||||
</Target>
|
||||
</Project>
|
||||
";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "third.proj")))) {
|
||||
sw.Write (third);
|
||||
}
|
||||
|
||||
project.LoadXml (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" InitialTargets=""pre"">
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
<Import Project='Test/resources/second.proj'/>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing pre target", "A1");
|
||||
logger.CheckLoggedMessageHead ("Executing Second::One target", "A2");
|
||||
logger.CheckLoggedMessageHead ("Executing Third::Two target", "A3");
|
||||
logger.CheckLoggedMessageHead ("Executing boo target", "A4");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("pre; One; Two", project.InitialTargets, "List of initial targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultTargets () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
project.LoadXml (@"<Project DefaultTargets='pre' xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" >
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing pre target", "A1");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("pre", project.DefaultTargets, "Default targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestDefaultTargetsWithImports () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
string second = @"<Project DefaultTargets='One' xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<Target Name=""One"">
|
||||
<Message Text='Executing Second::One target'/>
|
||||
</Target>
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
project.LoadXml (@"<Project DefaultTargets='pre' xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" >
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
<Import Project='Test/resources/second.proj'/>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing pre target", "A1");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("pre", project.DefaultTargets, "Default targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoDefaultTargetsWithImports () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
|
||||
string second = @"<Project DefaultTargets='; One ; Two' xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<Target Name=""One"">
|
||||
<Message Text='Executing Second::One target'/>
|
||||
</Target>
|
||||
<Target Name=""Two"">
|
||||
<Message Text='Executing Second::Two target'/>
|
||||
</Target>
|
||||
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
project.LoadXml (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" >
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
<Import Project='Test/resources/second.proj'/>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing Second::One target", "A1");
|
||||
logger.CheckLoggedMessageHead ("Executing Second::Two target", "A2");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("One; Two", project.DefaultTargets, "Default targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoDefaultTargets () {
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
project.LoadXml (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" >
|
||||
<Target Name=""boo"">
|
||||
<Message Text=""Executing boo target""/>
|
||||
</Target>
|
||||
<Target Name=""pre"">
|
||||
<Message Text=""Executing pre target""/>
|
||||
</Target>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Executing boo target", "A1");
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
|
||||
Assert.AreEqual ("", project.DefaultTargets, "Default targets");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPropertiesFromImportedProjects ()
|
||||
{
|
||||
Engine engine = new Engine (Consts.BinPath);
|
||||
Project project = engine.CreateNewProject ();
|
||||
|
||||
string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
|
||||
<PropertyGroup>
|
||||
<Prop1>InitialVal</Prop1>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Second Include=""$(ThirdProp):Third""/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name=""Main"">
|
||||
<Message Text=""Prop1: $(Prop1) FooItem: @(FooItem)""/>
|
||||
<Message Text=""Second: @(Second) ThirdProp: $(ThirdProp)""/>
|
||||
</Target>
|
||||
<Import Project=""third.proj""/>
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""3.5"">
|
||||
<PropertyGroup>
|
||||
<ThirdProp>Third Value</ThirdProp>
|
||||
</PropertyGroup>
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "third.proj")))) {
|
||||
sw.Write (third);
|
||||
}
|
||||
|
||||
project.LoadXml (@"<Project InitialTargets=""Main"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<ItemGroup>
|
||||
<FooItem Include=""$(Prop1):Something""/>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project=""Test/resources/second.proj""/>
|
||||
</Project>");
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
try {
|
||||
Assert.IsTrue (project.Build (), "Build failed");
|
||||
|
||||
logger.CheckLoggedMessageHead ("Prop1: InitialVal FooItem: InitialVal:Something", "A1");
|
||||
logger.CheckLoggedMessageHead ("Second: Third Value:Third ThirdProp: Third Value", "A2");
|
||||
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
} catch {
|
||||
logger.DumpMessages ();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestRequiredTask_String1 ()
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ using Microsoft.Build.BuildEngine;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using NUnit.Framework;
|
||||
using System.IO;
|
||||
|
||||
namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
[TestFixture]
|
||||
@@ -370,5 +371,54 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOverridingTargets ()
|
||||
{
|
||||
Engine engine;
|
||||
Project project;
|
||||
|
||||
string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<Target Name='BeforeBuild'/>
|
||||
<Target Name='AfterBuild'/>
|
||||
<Target Name='Build' DependsOnTargets='BeforeBuild'>
|
||||
<Message Text='Build executing'/>
|
||||
<CallTarget Targets='AfterBuild'/>
|
||||
</Target>
|
||||
</Project>";
|
||||
using (StreamWriter sw = new StreamWriter (Path.Combine ("Test", Path.Combine ("resources", "second.proj")))) {
|
||||
sw.Write (second);
|
||||
}
|
||||
|
||||
string documentString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
|
||||
<Target Name='AfterBuild'>
|
||||
<Message Text='Overriding AfterBuild'/>
|
||||
</Target>
|
||||
|
||||
<Import Project='Test/resources/second.proj'/>
|
||||
<Target Name='BeforeBuild'>
|
||||
<Message Text='Overriding BeforeBuild'/>
|
||||
</Target>
|
||||
</Project>";
|
||||
|
||||
engine = new Engine (Consts.BinPath);
|
||||
project = engine.CreateNewProject ();
|
||||
project.LoadXml (documentString);
|
||||
|
||||
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
|
||||
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
|
||||
engine.RegisterLogger (logger);
|
||||
|
||||
bool result = project.Build ("Build");
|
||||
if (!result) {
|
||||
logger.DumpMessages ();
|
||||
Assert.Fail ("Build failed");
|
||||
}
|
||||
|
||||
logger.CheckLoggedMessageHead ("Overriding BeforeBuild", "A1");
|
||||
logger.CheckLoggedMessageHead ("Build executing", "A1");
|
||||
|
||||
Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,16 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* Exec.cs: Write the commands, which can be multiline,
|
||||
to a temporary file, and execute that with "cmd.exe /c"
|
||||
on windows and "sh" on non-windows.
|
||||
(LogToolCommand): Override, and emit the commands instead
|
||||
of the actual args passed to the shell.
|
||||
|
||||
2009-09-28 Ankit Jain <[email protected]>
|
||||
|
||||
* WriteLinesToFiles.cs (Execute): Handle empty list of
|
||||
lines.
|
||||
|
||||
2009-09-25 Ankit Jain <[email protected]>
|
||||
|
||||
* FindAppConfigFile.cs: New.
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace Microsoft.Build.Tasks {
|
||||
string stdErrEncoding;
|
||||
string stdOutEncoding;
|
||||
string workingDirectory;
|
||||
string scriptFile;
|
||||
|
||||
public Exec ()
|
||||
{
|
||||
@@ -56,11 +57,15 @@ namespace Microsoft.Build.Tasks {
|
||||
|
||||
protected internal override void AddCommandLineCommands (CommandLineBuilderExtension commandLine)
|
||||
{
|
||||
if (IsRunningOnWindows)
|
||||
commandLine.AppendSwitch ("/c");
|
||||
|
||||
if (!String.IsNullOrEmpty (command)) {
|
||||
string[] commandTable = command.Split (null, 2);
|
||||
string arguments = String.Empty;
|
||||
if (commandTable.Length == 2)
|
||||
commandLine.AppendSwitch (commandTable [1]);
|
||||
scriptFile = Path.GetTempFileName ();
|
||||
using (StreamWriter sw = new StreamWriter (scriptFile)) {
|
||||
sw.Write (command);
|
||||
}
|
||||
commandLine.AppendFileNameIfNotNull (scriptFile);
|
||||
}
|
||||
base.AddCommandLineCommands (commandLine);
|
||||
}
|
||||
@@ -69,13 +74,18 @@ namespace Microsoft.Build.Tasks {
|
||||
string responseFileCommands,
|
||||
string commandLineCommands)
|
||||
{
|
||||
return base.ExecuteTool (pathToTool, responseFileCommands, commandLineCommands);
|
||||
try {
|
||||
return base.ExecuteTool (pathToTool, responseFileCommands, commandLineCommands);
|
||||
} finally {
|
||||
if (scriptFile != null)
|
||||
File.Delete (scriptFile);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected override string GenerateFullPathToTool ()
|
||||
{
|
||||
return command.Split (null, 2) [0];
|
||||
return IsRunningOnWindows ? "cmd.exe" : "sh";
|
||||
}
|
||||
|
||||
protected override string GetWorkingDirectory ()
|
||||
@@ -97,6 +107,7 @@ namespace Microsoft.Build.Tasks {
|
||||
[MonoTODO]
|
||||
protected override void LogToolCommand (string message)
|
||||
{
|
||||
Log.LogMessage (MessageImportance.Normal, "Executing: " + command);
|
||||
}
|
||||
|
||||
protected override void LogEventsFromTextOutput (string singleLine, MessageImportance importance)
|
||||
@@ -166,6 +177,14 @@ namespace Microsoft.Build.Tasks {
|
||||
get { return workingDirectory; }
|
||||
set { workingDirectory = value; }
|
||||
}
|
||||
|
||||
static bool IsRunningOnWindows {
|
||||
get {
|
||||
PlatformID pid = Environment.OSVersion.Platform;
|
||||
return ((int) pid != 128 && (int) pid != 4 && (int) pid != 6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace Microsoft.Build.Tasks {
|
||||
{
|
||||
try {
|
||||
streamWriter = new StreamWriter (file.GetMetadata ("FullPath"), !overwrite);
|
||||
foreach (ITaskItem line in lines) {
|
||||
streamWriter.WriteLine (line);
|
||||
}
|
||||
if (lines != null)
|
||||
foreach (ITaskItem line in lines)
|
||||
streamWriter.WriteLine (line);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
2009-09-29 Ankit Jain <[email protected]>
|
||||
|
||||
* ToolTask.cs (ExecuteTool): Use LogToolCommand, instead of
|
||||
directly logging.
|
||||
(LogToolCommand): Implement.
|
||||
|
||||
2009-09-28 Ankit Jain <[email protected]>
|
||||
|
||||
* ToolTask.cs (ProcessOuputTool): Move logging of tool
|
||||
output from here to ..
|
||||
(ExecuteTool): .. here. As, ProcessOuputTool can be
|
||||
overridden.
|
||||
|
||||
2009-09-24 Ankit Jain <[email protected]>
|
||||
|
||||
* ToolTask.cs (HasLoggedErrors): Add missing property.
|
||||
|
||||
@@ -138,8 +138,8 @@ namespace Microsoft.Build.Utilities
|
||||
arguments = arguments + " " + GetResponseFileSwitch (responseFileName);
|
||||
}
|
||||
|
||||
Log.LogMessage (MessageImportance.Normal, "Tool {0} execution started with arguments: {1} {2}",
|
||||
pathToTool, commandLineCommands, responseFileCommands);
|
||||
LogToolCommand (String.Format ("Tool {0} execution started with arguments: {1} {2}",
|
||||
pathToTool, commandLineCommands, responseFileCommands));
|
||||
|
||||
output = Path.GetTempFileName ();
|
||||
error = Path.GetTempFileName ();
|
||||
@@ -210,6 +210,7 @@ namespace Microsoft.Build.Utilities
|
||||
Log.LogError (output_str);
|
||||
}
|
||||
|
||||
toolOutput.AppendLine (line);
|
||||
LogEventsFromTextOutput (line, importance);
|
||||
}
|
||||
}
|
||||
@@ -217,8 +218,6 @@ namespace Microsoft.Build.Utilities
|
||||
|
||||
protected virtual void LogEventsFromTextOutput (string singleLine, MessageImportance importance)
|
||||
{
|
||||
toolOutput.AppendLine (singleLine);
|
||||
|
||||
singleLine = singleLine.Trim ();
|
||||
if (singleLine.Length == 0)
|
||||
return;
|
||||
@@ -346,6 +345,7 @@ namespace Microsoft.Build.Utilities
|
||||
[MonoTODO]
|
||||
protected virtual void LogToolCommand (string message)
|
||||
{
|
||||
Log.LogMessage (MessageImportance.Normal, message);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
|
||||
@@ -1,56 +1,60 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
using System.Security;
|
||||
|
||||
#if !PLATFORM_COMPACTFRAMEWORK
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
#endif
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("System.Data.SQLite")]
|
||||
[assembly: AssemblyDescription("ADO.NET 2.0 Data Provider for SQLite")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")]
|
||||
[assembly: AssemblyProduct("System.Data.SQLite")]
|
||||
[assembly: AssemblyCopyright("Public Domain")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
#if PLATFORM_COMPACTFRAMEWORK && RETARGETABLE
|
||||
[assembly: AssemblyFlags(AssemblyNameFlags.Retargetable)]
|
||||
#endif
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM componenets. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: CLSCompliant(true)]
|
||||
//[assembly: InternalsVisibleTo("System.Data.SQLite.Linq, PublicKey=002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0a25a843266973704137cbb0e7441c1fe7cae4e2440ae91ab8cde3933febcb1ac48dd33b40e13c421d8215c18a4349a436dd499e3c385cc683015f886f6c10bd90115eb2bd61b67750839e3a19941dc9c")]
|
||||
|
||||
#if !PLATFORM_COMPACTFRAMEWORK
|
||||
[assembly: AllowPartiallyTrustedCallers]
|
||||
[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
|
||||
#endif
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("2.0.0.0")]
|
||||
#if !PLATFORM_COMPACTFRAMEWORK
|
||||
[assembly: AssemblyFileVersion("1.0.61.0")]
|
||||
#endif
|
||||
|
||||
[assembly: AssemblyDelaySign (true)]
|
||||
[assembly: AssemblyKeyFile ("../mono.pub")]
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
using System.Security;
|
||||
|
||||
#if !PLATFORM_COMPACTFRAMEWORK
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
#endif
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("System.Data.SQLite")]
|
||||
[assembly: AssemblyDescription("ADO.NET 2.0 Data Provider for SQLite")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")]
|
||||
[assembly: AssemblyProduct("System.Data.SQLite")]
|
||||
[assembly: AssemblyCopyright("Public Domain")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
#if PLATFORM_COMPACTFRAMEWORK && RETARGETABLE
|
||||
[assembly: AssemblyFlags(AssemblyNameFlags.Retargetable)]
|
||||
#endif
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM componenets. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: CLSCompliant(true)]
|
||||
//[assembly: InternalsVisibleTo("System.Data.SQLite.Linq, PublicKey=002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0a25a843266973704137cbb0e7441c1fe7cae4e2440ae91ab8cde3933febcb1ac48dd33b40e13c421d8215c18a4349a436dd499e3c385cc683015f886f6c10bd90115eb2bd61b67750839e3a19941dc9c")]
|
||||
|
||||
#if !PLATFORM_COMPACTFRAMEWORK
|
||||
[assembly: AllowPartiallyTrustedCallers]
|
||||
[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
|
||||
#endif
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
#if !MONOTOUCH
|
||||
[assembly: AssemblyVersion("2.0.0.0")]
|
||||
#else // !MONOTOUCH
|
||||
[assembly: AssemblyVersion(Consts.FxVersion)]
|
||||
#endif // !MONOTOUCH
|
||||
#if !PLATFORM_COMPACTFRAMEWORK
|
||||
[assembly: AssemblyFileVersion("1.0.61.0")]
|
||||
#endif
|
||||
|
||||
[assembly: AssemblyDelaySign (true)]
|
||||
[assembly: AssemblyKeyFile ("../mono.pub")]
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-10-22 Jonathan Pryor <[email protected]>
|
||||
|
||||
* AssemblyInfo.cs: Use Consts.FxVersion when building for MONOTOUCH.
|
||||
|
||||
2004-04-30 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* AssemblyInfo.cs: Added
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-10-08 Jb Evain <[email protected]>
|
||||
|
||||
* LambdaExpression.cs (Compile): use the interpreter on MonoTouch.
|
||||
|
||||
2009-09-03 Jb Evain <[email protected]>
|
||||
|
||||
* ConstantExpression.cs (Emit): add support to emit DBNull values.
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace System.Linq.Expressions {
|
||||
|
||||
public Delegate Compile ()
|
||||
{
|
||||
#if TARGET_JVM
|
||||
#if TARGET_JVM || MONOTOUCH
|
||||
System.Linq.jvm.Interpreter inter =
|
||||
new System.Linq.jvm.Interpreter (this);
|
||||
inter.Validate ();
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
#include net_2_1_raw_System.Core.dll.sources
|
||||
System.Linq.jvm/Conversion.cs
|
||||
System.Linq.jvm/ExpressionInterpreter.cs
|
||||
System.Linq.jvm/ExpressionValidator.cs
|
||||
System.Linq.jvm/Interpreter.cs
|
||||
System.Linq.jvm/Math.cs
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-10-14 Jonathan Pryor <[email protected]>
|
||||
|
||||
* monotouch_System.Data.dll.sources: Added.
|
||||
|
||||
2009-08-17 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* System.Data_test.dll.sources: Added
|
||||
|
||||
@@ -30,7 +30,10 @@ LIB_MCS_FLAGS += \
|
||||
-r:rt.dll \
|
||||
-r:J2SE.Helpers.dll \
|
||||
$(OTHER_LIB_MCS_FLAGS)
|
||||
|
||||
else ifeq (monotouch, $(PROFILE))
|
||||
LIB_MCS_FLAGS += \
|
||||
-r:Mono.Data.Tds.dll \
|
||||
-r:System.Transactions.dll
|
||||
else
|
||||
LIB_MCS_FLAGS += \
|
||||
-r:System.EnterpriseServices.dll \
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2009-10-14 Jonathan Pryor <[email protected]>
|
||||
|
||||
* DbConnection.cs: Throw NotImplementedException fom
|
||||
DbConnection.DbProviderFactory, as DbProviderFactories isn't
|
||||
included in the MonoTouch profile.
|
||||
|
||||
2009-07-30 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* DbDataAdapter.cs (IDbDataAdapter.get_*Command): For non 2.0 profile, do not
|
||||
|
||||
@@ -718,7 +718,11 @@ namespace System.Data.Common {
|
||||
}
|
||||
|
||||
protected virtual DbProviderFactory DbProviderFactory {
|
||||
#if MONOTOUCH
|
||||
get {throw new NotImplementedException();}
|
||||
#else // MONOTOUCH
|
||||
get { return DbProviderFactories.GetFactory (this.GetType (). ToString ()); }
|
||||
#endif // MONOTOUCH
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-10-14 Jonathan Pryor <[email protected]>
|
||||
|
||||
* SqlConnection.cs: Remove EnterpriseServices dependency from the
|
||||
MonoTouch profile.
|
||||
|
||||
2009-08-17 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
** Fixes #525306
|
||||
|
||||
@@ -45,7 +45,9 @@ using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
#if !MONOTOUCH
|
||||
using System.EnterpriseServices;
|
||||
#endif // !MONOTOUCH
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
@@ -480,11 +482,13 @@ namespace System.Data.SqlClient
|
||||
}
|
||||
}
|
||||
|
||||
#if !MONOTOUCH
|
||||
[MonoTODO ("Not sure what this means at present.")]
|
||||
public void EnlistDistributedTransaction (ITransaction transaction)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endif // !MONOTOUCH
|
||||
|
||||
object ICloneable.Clone ()
|
||||
{
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
2009-09-15 Veerapuram Varadhan <vvaradhan@novell.com>
|
||||
|
||||
** Fixes #536194 - Patch by Andrew Kurochk <aaki.viper@gmail.com>
|
||||
* MergeManager.cs (Merge*): Do nothing when source and target
|
||||
datasets are same.
|
||||
|
||||
2009-10-14 Jonathan Pryor <jpryor@novell.com>
|
||||
|
||||
* XmlSchemaDataImporter.cs: Remove DbProviderFactories dependency in
|
||||
the MonoTouch profile.
|
||||
|
||||
2009-09-10 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
** Fixes #510176
|
||||
|
||||
@@ -95,6 +95,17 @@ namespace System.Data
|
||||
protected DataSet (SerializationInfo info, StreamingContext context)
|
||||
: this ()
|
||||
{
|
||||
#if NET_2_0
|
||||
if (IsBinarySerialized (info, context)) {
|
||||
BinaryDeserialize (info);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
string s = info.GetValue ("XmlSchema", typeof (String)) as String;
|
||||
XmlTextReader reader = new XmlTextReader (new StringReader (s));
|
||||
ReadXmlSchema (reader);
|
||||
reader.Close ();
|
||||
|
||||
GetSerializationData (info, context);
|
||||
}
|
||||
|
||||
@@ -1132,6 +1143,7 @@ namespace System.Data
|
||||
{
|
||||
#if NET_2_0
|
||||
if (RemotingFormat == SerializationFormat.Xml) {
|
||||
info.AddValue ("SchemaSerializationMode.DataSet", this.SchemaSerializationMode);
|
||||
#endif
|
||||
StringWriter sw = new StringWriter ();
|
||||
XmlTextWriter writer = new XmlTextWriter (sw);
|
||||
@@ -1155,19 +1167,8 @@ namespace System.Data
|
||||
#region Protected Methods
|
||||
protected void GetSerializationData (SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
#if NET_2_0
|
||||
if (IsBinarySerialized (info, context)) {
|
||||
BinaryDeserialize (info);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
string s = info.GetValue ("XmlSchema", typeof (String)) as String;
|
||||
string s = info.GetValue ("XmlDiffGram", typeof (String)) as String;
|
||||
XmlTextReader reader = new XmlTextReader (new StringReader (s));
|
||||
ReadXmlSchema (reader);
|
||||
reader.Close ();
|
||||
|
||||
s = info.GetValue ("XmlDiffGram", typeof (String)) as String;
|
||||
reader = new XmlTextReader (new StringReader (s));
|
||||
ReadXml (reader, XmlReadMode.DiffGram);
|
||||
reader.Close ();
|
||||
}
|
||||
@@ -1547,10 +1548,26 @@ namespace System.Data
|
||||
private bool dataSetInitialized = true;
|
||||
public event EventHandler Initialized;
|
||||
|
||||
[MonoTODO]
|
||||
protected DataSet (SerializationInfo info, StreamingContext context, bool constructSchema)
|
||||
: this (info, context)
|
||||
: this ()
|
||||
{
|
||||
if (DetermineSchemaSerializationMode (info, context) == SchemaSerializationMode.ExcludeSchema) {
|
||||
InitializeDerivedDataSet ();
|
||||
}
|
||||
|
||||
if (IsBinarySerialized (info, context)) {
|
||||
BinaryDeserialize (info);
|
||||
return;
|
||||
}
|
||||
|
||||
if (constructSchema) {
|
||||
string s = info.GetValue ("XmlSchema", typeof (String)) as String;
|
||||
XmlTextReader reader = new XmlTextReader (new StringReader (s));
|
||||
ReadXmlSchema (reader);
|
||||
reader.Close ();
|
||||
|
||||
GetSerializationData (info, context);
|
||||
}
|
||||
}
|
||||
|
||||
SerializationFormat remotingFormat = SerializationFormat.Xml;
|
||||
@@ -1751,10 +1768,8 @@ namespace System.Data
|
||||
OnDataSetInitialized (e);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected virtual void InitializeDerivedDataSet ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
protected SchemaSerializationMode DetermineSchemaSerializationMode (XmlReader reader)
|
||||
@@ -1764,6 +1779,13 @@ namespace System.Data
|
||||
|
||||
protected SchemaSerializationMode DetermineSchemaSerializationMode (SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
SerializationInfoEnumerator e = info.GetEnumerator ();
|
||||
while (e.MoveNext ()) {
|
||||
if (e.Name == "SchemaSerializationMode.DataSet") {
|
||||
return (SchemaSerializationMode) e.Value;
|
||||
}
|
||||
}
|
||||
|
||||
return SchemaSerializationMode.IncludeSchema;
|
||||
}
|
||||
|
||||
|
||||
@@ -1254,12 +1254,14 @@ namespace System.Data
|
||||
if (e == null)
|
||||
continue;
|
||||
|
||||
#if !MONOTOUCH
|
||||
if (e.LocalName == "Connections") {
|
||||
providerName = ((XmlElement)e.FirstChild).GetAttribute ("Provider");
|
||||
connString = ((XmlElement)e.FirstChild).GetAttribute ("AppSettingsPropertyName");
|
||||
provider = DbProviderFactories.GetFactory (providerName);
|
||||
continue;
|
||||
}
|
||||
#endif // !MONOTOUCH
|
||||
// #325464 debugging
|
||||
//Console.WriteLine ("ProviderName: " + providerName + "Connstr: " + connString);
|
||||
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
2009-09-26 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* DataSetTest2.cs: Don't run the test for Bug#536194 in 1.x
|
||||
profile. Makes build bot go all green on Sys.Data.
|
||||
|
||||
2009-09-26 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* DataSetTypedDataSet.cs: Test for #427769. Patch by
|
||||
John Lenz <[email protected]>.
|
||||
|
||||
2009-09-24 Veerapuram Varadhan <[email protected]>
|
||||
|
||||
* DataSetTest2.cs (MergeTest_SameDataSet_536194): Added new.
|
||||
* DataSetTest2.cs (MergeTest_SameDataSet_536194): Added new.
|
||||
|
||||
2009-01-16 Atsushi Enomoto <[email protected]>
|
||||
|
||||
|
||||
@@ -3467,6 +3467,7 @@ namespace MonoTests_System.Data
|
||||
Assert.AreEqual (typeof (string), ds.Tables [0].Columns [0].DataType, "#5");
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
[Test]
|
||||
public void MergeTest_SameDataSet_536194 ()
|
||||
{
|
||||
@@ -3479,6 +3480,7 @@ namespace MonoTests_System.Data
|
||||
dataSet.Merge(dataTable);
|
||||
Assert.AreEqual (1, dataSet.Tables.Count, "1");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_2_0
|
||||
[Test]
|
||||
|
||||
@@ -196,6 +196,58 @@ namespace MonoTests.System.Data
|
||||
myTypedDataSet.Order_DetailsRow[] drArr1 = ds.Orders[0].GetOrder_DetailsRows();
|
||||
DataRow[] drArr2 = ds.Orders[0].GetChildRows(ds.Relations[0]);
|
||||
Assert.AreEqual(drArr1 ,drArr2,"TDS25");
|
||||
|
||||
#if NET_2_0
|
||||
//now test serialization of a typed dataset generated by microsoft's xsd.exe
|
||||
DataSet1 ds1 = new DataSet1();
|
||||
ds1.DataTable1.AddDataTable1Row("test");
|
||||
ds1.DataTable1.AddDataTable1Row("test2");
|
||||
|
||||
global::System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter =
|
||||
new global::System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
|
||||
MemoryStream stream = new MemoryStream();
|
||||
|
||||
formatter.Serialize(stream, ds1);
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
DataSet1 ds1load = (DataSet1) formatter.Deserialize(stream);
|
||||
|
||||
Assert.IsTrue(ds1load.Tables.Contains("DataTable1"));
|
||||
Assert.AreEqual("DataTable1DataTable", ds1load.Tables["DataTable1"].GetType().Name);
|
||||
Assert.AreEqual(2, ds1load.DataTable1.Rows.Count);
|
||||
Assert.AreEqual("DataTable1Row", ds1load.DataTable1[0].GetType().Name);
|
||||
if (ds1load.DataTable1[0].Column1 == "test") {
|
||||
Assert.AreEqual("test2", ds1load.DataTable1[1].Column1);
|
||||
} else if (ds1load.DataTable1[0].Column1 == "test2") {
|
||||
Assert.AreEqual("test", ds1load.DataTable1[1].Column1);
|
||||
} else {
|
||||
Assert.Fail("Invalid entry for Column1");
|
||||
}
|
||||
|
||||
//now test when the mode is exclude schema
|
||||
ds1.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.ExcludeSchema;
|
||||
|
||||
stream = new MemoryStream();
|
||||
|
||||
formatter.Serialize(stream, ds1);
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
ds1load = (DataSet1) formatter.Deserialize(stream);
|
||||
|
||||
Assert.IsTrue(ds1load.Tables.Contains("DataTable1"));
|
||||
Assert.AreEqual("DataTable1DataTable", ds1load.Tables["DataTable1"].GetType().Name);
|
||||
Assert.AreEqual(2, ds1load.DataTable1.Rows.Count);
|
||||
Assert.AreEqual("DataTable1Row", ds1load.DataTable1[0].GetType().Name);
|
||||
if (ds1load.DataTable1[0].Column1 == "test") {
|
||||
Assert.AreEqual("test2", ds1load.DataTable1[1].Column1);
|
||||
} else if (ds1load.DataTable1[0].Column1 == "test2") {
|
||||
Assert.AreEqual("test", ds1load.DataTable1[1].Column1);
|
||||
} else {
|
||||
Assert.Fail("Invalid entry for Column1");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
protected void T_Changing(object sender, myTypedDataSet.OrdersRowChangeEvent e)
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
Assembly/AssemblyInfo.cs
|
||||
../../build/common/Consts.cs.in
|
||||
../../build/common/Locale.cs
|
||||
System.Data/AcceptRejectRule.cs
|
||||
System.Data/ColumnTypeConverter.cs
|
||||
System.Data/CommandBehavior.cs
|
||||
System.Data/CommandType.cs
|
||||
System.Data/ConnectionState.cs
|
||||
System.Data/ConflictOption.cs
|
||||
System.Data/Constraint.cs
|
||||
System.Data/ConstraintCollection.cs
|
||||
System.Data/ConstraintConverter.cs
|
||||
System.Data/ConstraintException.cs
|
||||
System.Data/DataCategoryAttribute.cs
|
||||
System.Data/DataColumn.cs
|
||||
System.Data/DataColumnChangeEventArgs.cs
|
||||
System.Data/DataColumnChangeEventHandler.cs
|
||||
System.Data/DataColumnCollection.cs
|
||||
System.Data/DataColumnPropertyDescriptor.cs
|
||||
System.Data/DataException.cs
|
||||
System.Data/RelatedDataView.cs
|
||||
System.Data/RelationshipConverter.cs
|
||||
System.Data/DataRelation.cs
|
||||
System.Data/DataRelationCollection.cs
|
||||
System.Data/DataRelationPropertyDescriptor.cs
|
||||
System.Data/DataRow.cs
|
||||
System.Data/DataRowAction.cs
|
||||
System.Data/DataRowBuilder.cs
|
||||
System.Data/DataRowChangeEventArgs.cs
|
||||
System.Data/DataRowChangeEventHandler.cs
|
||||
System.Data/DataRowCollection.cs
|
||||
System.Data/DataRowState.cs
|
||||
System.Data/DataRowVersion.cs
|
||||
System.Data/DataRowView.cs
|
||||
System.Data/DataSet.cs
|
||||
System.Data/DataSetDateTime.cs
|
||||
System.Data/DataSysDescriptionAttribute.cs
|
||||
System.Data/DataTable.cs
|
||||
System.Data/DataTableCollection.cs
|
||||
System.Data/DataTableClearEventArgs.cs
|
||||
System.Data/DataTableClearEventHandler.cs
|
||||
System.Data/DataTableTypeConverter.cs
|
||||
System.Data/DataTablePropertyDescriptor.cs
|
||||
System.Data/DataTableReader.cs
|
||||
System.Data/DataTableNewRowEventArgs.cs
|
||||
System.Data/DataTableNewRowEventHandler.cs
|
||||
System.Data/DataView.cs
|
||||
System.Data/DataViewManager.cs
|
||||
System.Data/DataViewManagerListItemTypeDescriptor.cs
|
||||
System.Data/DataViewRowState.cs
|
||||
System.Data/DataViewSetting.cs
|
||||
System.Data/DataViewSettingCollection.cs
|
||||
System.Data/DBConcurrencyException.cs
|
||||
System.Data/DbType.cs
|
||||
System.Data/DefaultValueTypeConverter.cs
|
||||
System.Data/DeletedRowInaccessibleException.cs
|
||||
System.Data/DuplicateNameException.cs
|
||||
System.Data/EvaluateException.cs
|
||||
System.Data/FillErrorEventArgs.cs
|
||||
System.Data/FillErrorEventHandler.cs
|
||||
System.Data/ForeignKeyConstraint.cs
|
||||
System.Data/IColumnMapping.cs
|
||||
System.Data/IColumnMappingCollection.cs
|
||||
System.Data/IDataAdapter.cs
|
||||
System.Data/IDataParameter.cs
|
||||
System.Data/IDataParameterCollection.cs
|
||||
System.Data/IDataReader.cs
|
||||
System.Data/IDataRecord.cs
|
||||
System.Data/IDbCommand.cs
|
||||
System.Data/IDbConnection.cs
|
||||
System.Data/IDbDataAdapter.cs
|
||||
System.Data/IDbDataParameter.cs
|
||||
System.Data/IDbTransaction.cs
|
||||
System.Data/InRowChangingEventException.cs
|
||||
System.Data/InternalDataCollectionBase.cs
|
||||
System.Data/InvalidConstraintException.cs
|
||||
System.Data/InvalidExpressionException.cs
|
||||
System.Data/ISafeDataRecord.cs
|
||||
System.Data/IsolationLevel.cs
|
||||
System.Data/ITableMapping.cs
|
||||
System.Data/ITableMappingCollection.cs
|
||||
System.Data/KeyRestrictionBehavior.cs
|
||||
System.Data/LoadOption.cs
|
||||
System.Data/MappingType.cs
|
||||
System.Data/MergeFailedEventArgs.cs
|
||||
System.Data/MergeFailedEventHandler.cs
|
||||
System.Data/MergeManager.cs
|
||||
System.Data/MissingMappingAction.cs
|
||||
System.Data/MissingPrimaryKeyException.cs
|
||||
System.Data/MissingSchemaAction.cs
|
||||
System.Data/Node.cs
|
||||
System.Data/NoNullAllowedException.cs
|
||||
System.Data/OperationAbortedException.cs
|
||||
System.Data/ParameterDirection.cs
|
||||
System.Data/PropertyAttributes.cs
|
||||
System.Data/PropertyCollection.cs
|
||||
System.Data/ReadOnlyException.cs
|
||||
System.Data/ResDescriptionAttribute.cs
|
||||
System.Data/RowNotInTableException.cs
|
||||
System.Data/Rule.cs
|
||||
System.Data/SchemaType.cs
|
||||
System.Data/SerializationFormat.cs
|
||||
System.Data/SchemaSerializationMode.cs
|
||||
System.Data/SqlDbType.cs
|
||||
System.Data/StateChangeEventArgs.cs
|
||||
System.Data/StateChangeEventHandler.cs
|
||||
System.Data/StatementCompletedEventArgs.cs
|
||||
System.Data/StatementCompletedEventHandler.cs
|
||||
System.Data/StatementType.cs
|
||||
System.Data/StrongTypingException.cs
|
||||
System.Data/SyntaxErrorException.cs
|
||||
../../build/common/MonoTODOAttribute.cs
|
||||
System.Data/TableAdapterSchemaInfo.cs
|
||||
System.Data/TypeDataSetGeneratorException.cs
|
||||
System.Data/UniqueConstraint.cs
|
||||
System.Data/UpdateRowSource.cs
|
||||
System.Data/UpdateStatus.cs
|
||||
System.Data/VersionNotFoundException.cs
|
||||
System.Data/XmlDataInferenceLoader.cs
|
||||
System.Data/XmlHelper.cs
|
||||
System.Data/XmlDataReader.cs
|
||||
System.Data/XmlReadMode.cs
|
||||
System.Data/XmlWriteMode.cs
|
||||
System.Data/XmlConstants.cs
|
||||
System.Data/XmlDiffLoader.cs
|
||||
System.Data.Common/CatalogLocation.cs
|
||||
System.Data.Common/ComparerFactory.cs
|
||||
System.Data.Common/DataAdapter.cs
|
||||
System.Data.Common/DataColumnMappingCollection.cs
|
||||
System.Data.Common/DataColumnMapping.cs
|
||||
System.Data.Common/DataColumnMappingConverter.cs
|
||||
System.Data.Common/DataContainer.cs
|
||||
System.Data.Common/DataTableMappingCollection.cs
|
||||
System.Data.Common/DataTableMapping.cs
|
||||
System.Data.Common/DataTableMappingConverter.cs
|
||||
System.Data.Common/DbCommandBuilder.cs
|
||||
System.Data.Common/DbConnectionStringBuilder.cs
|
||||
System.Data.Common/DbConnectionStringBuilderHelper.cs
|
||||
System.Data.Common/DbCommand.cs
|
||||
System.Data.Common/DbConnection.cs
|
||||
System.Data.Common/DbConnectionOptions.cs
|
||||
System.Data.Common/DbConnectionString.cs
|
||||
System.Data.Common/DbDataAdapter.cs
|
||||
System.Data.Common/DbDataPermissionAttribute.cs
|
||||
System.Data.Common/DbDataPermission.cs
|
||||
System.Data.Common/DbDataReader.cs
|
||||
System.Data.Common/DbDataRecord.cs
|
||||
System.Data.Common/DbDataSourceEnumerator.cs
|
||||
System.Data.Common/DbEnumerator.cs
|
||||
System.Data.Common/DbException.cs
|
||||
System.Data.Common/DbMetaDataCollectionNames.cs
|
||||
System.Data.Common/DbMetaDataColumnNames.cs
|
||||
System.Data.Common/DbParameterCollection.cs
|
||||
System.Data.Common/DbParameter.cs
|
||||
System.Data.Common/DbProviderFactory.cs
|
||||
System.Data.Common/DbProviderSpecificTypePropertyAttribute.cs
|
||||
System.Data.Common/DbTable.cs
|
||||
System.Data.Common/DbTransaction.cs
|
||||
System.Data.Common/DbTypes.cs
|
||||
System.Data.Common/ExceptionHelper.cs
|
||||
System.Data.Common/FieldNameLookup.cs
|
||||
System.Data.Common/GroupByBehavior.cs
|
||||
System.Data.Common/IdentifierCase.cs
|
||||
System.Data.Common/Index.cs
|
||||
System.Data.Common/Key.cs
|
||||
System.Data.Common/PermissionHelper.cs
|
||||
System.Data.Common/RecordCache.cs
|
||||
System.Data.Common/RowUpdatedEventArgs.cs
|
||||
System.Data.Common/RowUpdatingEventArgs.cs
|
||||
System.Data.Common/SchemaInfo.cs
|
||||
System.Data.Common/SchemaTableColumn.cs
|
||||
System.Data.Common/SchemaTableOptionalColumn.cs
|
||||
System.Data.Common/SupportedJoinOperators.cs
|
||||
System.Data.SqlTypes/INullable.cs
|
||||
System.Data.SqlTypes/SqlBinary.cs
|
||||
System.Data.SqlTypes/SqlBoolean.cs
|
||||
System.Data.SqlTypes/SqlByte.cs
|
||||
System.Data.SqlTypes/SqlBytes.cs
|
||||
System.Data.SqlTypes/SqlChars.cs
|
||||
System.Data.SqlTypes/SqlCompareOptions.cs
|
||||
System.Data.SqlTypes/SqlDateTime.cs
|
||||
System.Data.SqlTypes/SqlDecimal.cs
|
||||
System.Data.SqlTypes/SqlDouble.cs
|
||||
System.Data.SqlTypes/SqlGuid.cs
|
||||
System.Data.SqlTypes/SqlInt16.cs
|
||||
System.Data.SqlTypes/SqlInt32.cs
|
||||
System.Data.SqlTypes/SqlInt64.cs
|
||||
System.Data.SqlTypes/SqlMoney.cs
|
||||
System.Data.SqlTypes/SqlNullValueException.cs
|
||||
System.Data.SqlTypes/SqlSingle.cs
|
||||
System.Data.SqlTypes/SqlString.cs
|
||||
System.Data.SqlTypes/SqlTruncateException.cs
|
||||
System.Data.SqlTypes/SqlTypeException.cs
|
||||
System.Data.SqlTypes/StorageState.cs
|
||||
System.Data.SqlTypes/SqlAlreadyFilledException.cs
|
||||
System.Data.SqlTypes/SqlNotFilledException.cs
|
||||
System.Data.SqlTypes/SqlXml.cs
|
||||
System.Data.Sql/SqlDataSourceEnumerator.cs
|
||||
System.Data.Sql/SqlNotificationRequest.cs
|
||||
Microsoft.SqlServer.Server/Format.cs
|
||||
Microsoft.SqlServer.Server/DataAccessKind.cs
|
||||
Microsoft.SqlServer.Server/IBinarySerialize.cs
|
||||
Microsoft.SqlServer.Server/InvalidUdtException.cs
|
||||
Microsoft.SqlServer.Server/SqlFunctionAttribute.cs
|
||||
Microsoft.SqlServer.Server/SqlMetaData.cs
|
||||
Microsoft.SqlServer.Server/SqlMethodAttribute.cs
|
||||
Microsoft.SqlServer.Server/SqlUserDefinedAggregateAttribute.cs
|
||||
Microsoft.SqlServer.Server/SqlUserDefinedTypeAttribute.cs
|
||||
Microsoft.SqlServer.Server/SystemDataAccessKind.cs
|
||||
Microsoft.SqlServer.Server/SqlFacetAttribute.cs
|
||||
Microsoft.SqlServer.Server/TriggerAction.cs
|
||||
Microsoft.SqlServer.Server/SqlTriggerContext.cs
|
||||
Microsoft.SqlServer.Server/SqlProcedureAttribute.cs
|
||||
Microsoft.SqlServer.Server/SqlTriggerAttribute.cs
|
||||
System.Data.SqlClient/SqlNotificationType.cs
|
||||
System.Data.SqlClient/SqlNotificationInfo.cs
|
||||
System.Data.SqlClient/SqlNotificationSource.cs
|
||||
System.Data.SqlClient/SqlAsyncState.cs
|
||||
System.Data.SqlClient/SqlAsyncResult.cs
|
||||
System.Data.SqlClient/SqlClientMetaDataCollectionNames.cs
|
||||
System.Data.SqlClient/SqlClientPermission.cs
|
||||
System.Data.SqlClient/SqlClientPermissionAttribute.cs
|
||||
System.Data.SqlClient/SqlCommand.cs
|
||||
System.Data.SqlClient/SqlCommandBuilder.cs
|
||||
System.Data.SqlClient/SqlConnection.cs
|
||||
System.Data.SqlClient/SqlConnectionStringBuilder.cs
|
||||
System.Data.SqlClient/SqlDataAdapter.cs
|
||||
System.Data.SqlClient/SqlDataReader.cs
|
||||
System.Data.SqlClient/SqlDataSourceConverter.cs
|
||||
System.Data.SqlClient/SqlDependency.cs
|
||||
System.Data.SqlClient/SqlError.cs
|
||||
System.Data.SqlClient/SqlErrorCollection.cs
|
||||
System.Data.SqlClient/SqlException.cs
|
||||
System.Data.SqlClient/SqlInfoMessageEventArgs.cs
|
||||
System.Data.SqlClient/SqlInfoMessageEventHandler.cs
|
||||
System.Data.SqlClient/SqlInitialCatalogConverter.cs
|
||||
System.Data.SqlClient/NetworkLibraryConverter.cs
|
||||
System.Data.SqlClient/SqlParameter.cs
|
||||
System.Data.SqlClient/SqlParameterCollection.cs
|
||||
System.Data.SqlClient/SqlParameterConverter.cs
|
||||
System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
|
||||
System.Data.SqlClient/SqlRowUpdatedEventHandler.cs
|
||||
System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
|
||||
System.Data.SqlClient/SqlRowUpdatingEventHandler.cs
|
||||
System.Data.SqlClient/SqlTransaction.cs
|
||||
System.Data.SqlClient/SqlXmlTextReader.cs
|
||||
System.Data.SqlClient/SQLDebugging.cs
|
||||
System.Data.SqlClient/SqlClientFactory.cs
|
||||
System.Data.SqlClient/SqlBulkCopy.cs
|
||||
System.Data.SqlClient/SqlBulkCopyOptions.cs
|
||||
System.Data.SqlClient/SqlBulkCopyColumnMapping.cs
|
||||
System.Data.SqlClient/SqlBulkCopyColumnMappingCollection.cs
|
||||
System.Data.SqlClient/SqlRowsCopiedEventHandler.cs
|
||||
System.Data.SqlClient/SqlRowsCopiedEventArgs.cs
|
||||
System.Data.SqlClient/SqlNotificationEventArgs.cs
|
||||
System.Data.SqlClient/OnChangeEventHandler.cs
|
||||
System.Data/XmlDataLoader.cs
|
||||
System.Data/XmlSchemaDataImporter.cs
|
||||
System.Data/XmlSchemaWriter.cs
|
||||
System.Data/XmlTableWriter.cs
|
||||
System.Xml/XmlDataDocument.cs
|
||||
Mono.Data.SqlExpressions/Tokenizer.cs
|
||||
Mono.Data.SqlExpressions/Numeric.cs
|
||||
Mono.Data.SqlExpressions/Expressions.cs
|
||||
Mono.Data.SqlExpressions/Literal.cs
|
||||
Mono.Data.SqlExpressions/ColumnReference.cs
|
||||
Mono.Data.SqlExpressions/ArithmeticExpressions.cs
|
||||
Mono.Data.SqlExpressions/BooleanExpressions.cs
|
||||
Mono.Data.SqlExpressions/Comparison.cs
|
||||
Mono.Data.SqlExpressions/StringFunctions.cs
|
||||
Mono.Data.SqlExpressions/Functions.cs
|
||||
Mono.Data.SqlExpressions/Like.cs
|
||||
Mono.Data.SqlExpressions/In.cs
|
||||
Mono.Data.SqlExpressions/Aggregation.cs
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-10-05 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* JsonReader.cs : \uXXXX parser was totally wrong, giving wrong #.
|
||||
|
||||
2009-09-22 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* JsonValue.cs, JsonReader.cs, JsonPrimitive.cs :
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace System.Json
|
||||
case '"':
|
||||
case '\\':
|
||||
case '/':
|
||||
vb.Append (c);
|
||||
vb.Append ((char) c);
|
||||
break;
|
||||
case 'b':
|
||||
vb.Append ('\x8');
|
||||
@@ -279,13 +279,14 @@ namespace System.Json
|
||||
case 'u':
|
||||
ushort cp = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
cp <<= 4;
|
||||
if ((c = ReadChar ()) < 0)
|
||||
throw JsonError ("Incomplete unicode character escape literal");
|
||||
if ('0' >= c && c <= '9')
|
||||
if ('0' <= c && c <= '9')
|
||||
cp += (ushort) (c - '0');
|
||||
if ('A' >= c && c <= 'F')
|
||||
if ('A' <= c && c <= 'F')
|
||||
cp += (ushort) (c - 'A' + 10);
|
||||
if ('a' >= c && c <= 'f')
|
||||
if ('a' <= c && c <= 'f')
|
||||
cp += (ushort) (c - 'a' + 10);
|
||||
}
|
||||
vb.Append ((char) cp);
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
2009-09-29 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* net_2_1_raw_System.Net.dll.sources: Remove Timer_2_1.cs and
|
||||
related classes from System.dll - they are not required anymore
|
||||
since Gonzalo's changes on Socket.Close(int)
|
||||
[Backport r142851]
|
||||
|
||||
2009-09-27 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* net_2_1_raw_System.Net.dll.sources: Add Timer_2_1.cs and
|
||||
related classes from System.dll
|
||||
[Backport of r142720]
|
||||
|
||||
2009-09-24 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* net_2_1_raw_System.Net.dll.sources: Substitute System.dll Dns
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
2009-09-21 Sebastien Pouliot <sebastien@ximian.com>
|
||||
2009-10-23 Atsushi Enomoto <atsushi@ximian.com>
|
||||
|
||||
* net_2_1_raw_System.Runtime.Serialization.dll.sources: Remove
|
||||
System.Xml/XmlMtomDictionaryWriter.cs
|
||||
* monotouch_System.Runtime.Serialization.dll.sources :
|
||||
add OnXmlDictionaryReaderClose.cs.
|
||||
|
||||
2009-09-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-10-21 Jb Evain <[email protected]>
|
||||
|
||||
* SerializationMap.cs, KnownTypeCollection.cs: avoid using LINQ
|
||||
on arrays as MonoTouch has issues with them.
|
||||
|
||||
2009-09-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* IgnoreDataMemberAttribute.cs : add missing type.
|
||||
|
||||
+10
-1
@@ -675,10 +675,19 @@ namespace System.Runtime.Serialization
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool TypeImplementsIDictionary (Type type)
|
||||
{
|
||||
foreach (var iface in type.GetInterfaces ())
|
||||
if (iface == typeof (IDictionary) || (iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (IDictionary<,>)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// it also supports contract-based dictionary.
|
||||
private DictionaryTypeMap RegisterDictionary (Type type)
|
||||
{
|
||||
if (!type.GetInterfaces ().Any (t => t == typeof (IDictionary) || t.FullName.StartsWith ("System.Collections.Generic.IDictionary")))
|
||||
if (!TypeImplementsIDictionary (type))
|
||||
return null;
|
||||
|
||||
var cdca = GetAttribute<CollectionDataContractAttribute> (type);
|
||||
|
||||
+21
-6
@@ -614,8 +614,7 @@ namespace System.Runtime.Serialization
|
||||
{
|
||||
element_type = elementType;
|
||||
element_qname = KnownTypes.GetQName (element_type);
|
||||
var icoll = RuntimeType.GetInterfaces ().FirstOrDefault (
|
||||
iface => iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (ICollection<>));
|
||||
var icoll = GetGenericCollectionInterface (RuntimeType);
|
||||
if (icoll != null) {
|
||||
if (RuntimeType.IsInterface) {
|
||||
add_method = RuntimeType.GetMethod ("Add", icoll.GetGenericArguments ());
|
||||
@@ -632,6 +631,15 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
static Type GetGenericCollectionInterface (Type type)
|
||||
{
|
||||
foreach (var iface in type.GetInterfaces ())
|
||||
if (iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (ICollection<>))
|
||||
return iface;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool OutputXsiType {
|
||||
get { return false; }
|
||||
}
|
||||
@@ -661,8 +669,7 @@ namespace System.Runtime.Serialization
|
||||
if (RuntimeType.IsArray)
|
||||
return new ArrayList ();
|
||||
if (RuntimeType.IsInterface) {
|
||||
var icoll = RuntimeType.GetInterfaces ().FirstOrDefault (
|
||||
iface => iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (ICollection<>));
|
||||
var icoll = GetGenericCollectionInterface (RuntimeType);
|
||||
if (icoll != null)
|
||||
return Activator.CreateInstance (typeof (List<>).MakeGenericType (RuntimeType.GetGenericArguments () [0])); // List<T>
|
||||
else // non-generic
|
||||
@@ -765,8 +772,7 @@ namespace System.Runtime.Serialization
|
||||
key_type = typeof (object);
|
||||
value_type = typeof (object);
|
||||
|
||||
var idic = RuntimeType.GetInterfaces ().FirstOrDefault (
|
||||
iface => iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (IDictionary<,>));
|
||||
var idic = GetGenericDictionaryInterface (RuntimeType);
|
||||
if (idic != null) {
|
||||
var imap = RuntimeType.GetInterfaceMap (idic);
|
||||
for (int i = 0; i < imap.InterfaceMethods.Length; i++)
|
||||
@@ -787,6 +793,15 @@ namespace System.Runtime.Serialization
|
||||
value_qname = GetValueQName ();
|
||||
}
|
||||
|
||||
static Type GetGenericDictionaryInterface (Type type)
|
||||
{
|
||||
foreach (var iface in type.GetInterfaces ())
|
||||
if (iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (IDictionary<,>))
|
||||
return iface;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
string ContractNamespace {
|
||||
get { return a != null && !String.IsNullOrEmpty (a.Namespace) ? a.Namespace : KnownTypeCollection.MSArraysNamespace; }
|
||||
}
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
2009-09-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* XsdDataContractExporterTest.cs : disable some tests that started
|
||||
to fail due to correctly sorted fields while xsd exporter has
|
||||
some bugs that emits duplicate fields (hence ambiguity occurs).
|
||||
|
||||
2009-09-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* XmlObjectSerializerTest.cs : Test nested type serialization type
|
||||
initialization.
|
||||
|
||||
2009-09-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* XmlObjectSerializerTest.cs : fix (here too) bad serialization-
|
||||
|
||||
+15
@@ -1262,6 +1262,12 @@ namespace MonoTests.System.Runtime.Serialization
|
||||
new DataContractSerializer(typeof (AsxEntryInfo)).ReadObject (reader);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Bug539563 ()
|
||||
{
|
||||
new DataContractSerializer (typeof (NestedContractType));
|
||||
}
|
||||
|
||||
private T Deserialize<T> (string xml)
|
||||
{
|
||||
return Deserialize<T> (xml, typeof (T));
|
||||
@@ -1604,6 +1610,15 @@ namespace MonoTests.System.Runtime.Serialization
|
||||
[DataMember]
|
||||
public IList<int> Array { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class NestedContractType
|
||||
{
|
||||
[DataMember]
|
||||
public NestedContractType Nested;
|
||||
[DataMember]
|
||||
public string X = "x";
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
|
||||
+2
@@ -136,6 +136,7 @@ namespace MonoTests.System.Runtime.Serialization
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void Dc3Test ()
|
||||
{
|
||||
//Check for duplicate dc2 ?
|
||||
@@ -145,6 +146,7 @@ namespace MonoTests.System.Runtime.Serialization
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void Dc3Test2 ()
|
||||
{
|
||||
//Check for duplicate dc2 ?
|
||||
|
||||
+1
@@ -1 +1,2 @@
|
||||
#include net_2_1_raw_System.Runtime.Serialization.dll.sources
|
||||
System.Xml/OnXmlDictionaryReaderClose.cs
|
||||
@@ -1,3 +1,18 @@
|
||||
2009-10-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* monotouch_System.ServiceModel.Web.dll.sources:
|
||||
adding experimental WebHttpBinding stuff.
|
||||
|
||||
2009-10-08 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* System.ServiceModel.Web_test.dll.sources :
|
||||
add WebScriptEnablingBehaviorTest.cs.
|
||||
|
||||
2009-10-02 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* System.ServiceModel.Web_test.dll.sources :
|
||||
add WebScriptServiceHostFactoryTest.cs.
|
||||
|
||||
2009-09-17 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Makefile : add -r:System.Web.Extensions.dll.
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
2009-10-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* DataContractJsonSerializer.cs
|
||||
TypeMap.cs
|
||||
JsonSerializationReader.cs : add experimental monotouch build.
|
||||
|
||||
2009-10-08 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* DataContractJsonSerializer.cs, JsonSerializationWriter.cs:
|
||||
alwaysEmitTypeInformation is false by default. It is for __type
|
||||
attribute, not for type attribute. __type name is always with ":#".
|
||||
* TypeMap.cs : sort members in default typemap (it is ordered).
|
||||
Uncomment EmitDefaultValue.
|
||||
* JsonWriter.cs : handle "null" string (it is somewhat messy).
|
||||
|
||||
2009-10-05 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* JsonReader.cs : copy string literal parser from System.Json.
|
||||
|
||||
2009-09-22 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* JsonSerializationWriter.cs : output "type" attribute on bool
|
||||
|
||||
+28
-15
@@ -64,7 +64,7 @@ namespace System.Runtime.Serialization.Json
|
||||
}
|
||||
|
||||
public DataContractJsonSerializer (Type type, string rootName, IEnumerable<Type> knownTypes)
|
||||
: this (type, rootName, knownTypes, int.MaxValue, false, null, true)
|
||||
: this (type, rootName, knownTypes, int.MaxValue, false, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -73,14 +73,9 @@ namespace System.Runtime.Serialization.Json
|
||||
{
|
||||
}
|
||||
|
||||
public DataContractJsonSerializer (Type type, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
|
||||
: this (type, default_root_name, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, dataContractSurrogate, alwaysEmitTypeInformation)
|
||||
{
|
||||
}
|
||||
|
||||
public DataContractJsonSerializer (Type type, string rootName, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
|
||||
{
|
||||
if (type == null)
|
||||
DataContractJsonSerializer(Type type, string rootName, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool alwaysEmitTypeInformation)
|
||||
{
|
||||
if (type == null)
|
||||
throw new ArgumentNullException ("type");
|
||||
if (rootName == null)
|
||||
throw new ArgumentNullException ("rootName");
|
||||
@@ -97,29 +92,43 @@ namespace System.Runtime.Serialization.Json
|
||||
root = rootName;
|
||||
max_items = maxItemsInObjectGraph;
|
||||
ignore_extension = ignoreExtensionDataObject;
|
||||
surrogate = dataContractSurrogate;
|
||||
always_emit_type = alwaysEmitTypeInformation;
|
||||
}
|
||||
|
||||
public DataContractJsonSerializer (Type type, XmlDictionaryString rootName, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
|
||||
: this (type, rootName != null ? rootName.Value : null, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, dataContractSurrogate, alwaysEmitTypeInformation)
|
||||
#if !NET_2_1 || MONOTOUCH
|
||||
public DataContractJsonSerializer (Type type, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
|
||||
: this (type, default_root_name, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, alwaysEmitTypeInformation)
|
||||
{
|
||||
}
|
||||
|
||||
public DataContractJsonSerializer (Type type, string rootName, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
|
||||
: this (type, rootName, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, alwaysEmitTypeInformation)
|
||||
{
|
||||
surrogate = dataContractSurrogate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
public DataContractJsonSerializer (Type type, XmlDictionaryString rootName, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation)
|
||||
: this (type, rootName != null ? rootName.Value : default_root_name, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, dataContractSurrogate, alwaysEmitTypeInformation)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
Type type;
|
||||
#endregion
|
||||
|
||||
Type type;
|
||||
string root;
|
||||
ReadOnlyCollection<Type> known_types;
|
||||
int max_items;
|
||||
bool ignore_extension;
|
||||
IDataContractSurrogate surrogate;
|
||||
bool always_emit_type;
|
||||
#if !NET_2_1 || MONOTOUCH
|
||||
IDataContractSurrogate surrogate;
|
||||
|
||||
[MonoTODO]
|
||||
public IDataContractSurrogate DataContractSurrogate {
|
||||
get { return surrogate; }
|
||||
}
|
||||
#endif
|
||||
|
||||
[MonoTODO]
|
||||
public bool IgnoreExtensionDataObject {
|
||||
@@ -150,7 +159,11 @@ namespace System.Runtime.Serialization.Json
|
||||
|
||||
public override object ReadObject (Stream stream)
|
||||
{
|
||||
#if NET_2_1
|
||||
return ReadObject(JsonReaderWriterFactory.CreateJsonReader(stream, XmlDictionaryReaderQuotas.Max));
|
||||
#else
|
||||
return ReadObject (JsonReaderWriterFactory.CreateJsonReader (stream, new XmlDictionaryReaderQuotas ()));
|
||||
#endif
|
||||
}
|
||||
|
||||
public override object ReadObject (XmlDictionaryReader reader)
|
||||
|
||||
@@ -635,19 +635,66 @@ namespace System.Runtime.Serialization.Json
|
||||
return '0' <= c && c <= '9';
|
||||
}
|
||||
|
||||
// FIXME: implement
|
||||
StringBuilder vb = new StringBuilder ();
|
||||
|
||||
string ReadStringLiteral ()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
vb.Length = 0;
|
||||
while (true) {
|
||||
int c = ReadChar ();
|
||||
if (c < 0)
|
||||
throw XmlError ("JSON string is not closed");
|
||||
if (c == '"')
|
||||
return vb.ToString ();
|
||||
else if (c != '\\') {
|
||||
vb.Append ((char) c);
|
||||
continue;
|
||||
}
|
||||
|
||||
do {
|
||||
int ch = ReadChar ();
|
||||
if (ch < 0)
|
||||
throw XmlError ("Unexpected end of stream in string literal");
|
||||
if (ch == '"')
|
||||
return sb.ToString ();
|
||||
sb.Append ((char) ch);
|
||||
} while (true);
|
||||
// escaped expression
|
||||
c = ReadChar ();
|
||||
if (c < 0)
|
||||
throw XmlError ("Invalid JSON string literal; incomplete escape sequence");
|
||||
switch (c) {
|
||||
case '"':
|
||||
case '\\':
|
||||
case '/':
|
||||
vb.Append ((char) c);
|
||||
break;
|
||||
case 'b':
|
||||
vb.Append ('\x8');
|
||||
break;
|
||||
case 'f':
|
||||
vb.Append ('\f');
|
||||
break;
|
||||
case 'n':
|
||||
vb.Append ('\n');
|
||||
break;
|
||||
case 'r':
|
||||
vb.Append ('\r');
|
||||
break;
|
||||
case 't':
|
||||
vb.Append ('\t');
|
||||
break;
|
||||
case 'u':
|
||||
ushort cp = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if ((c = ReadChar ()) < 0)
|
||||
throw XmlError ("Incomplete unicode character escape literal");
|
||||
cp *= 16;
|
||||
if ('0' <= c && c <= '9')
|
||||
cp += (ushort) (c - '0');
|
||||
if ('A' <= c && c <= 'F')
|
||||
cp += (ushort) (c - 'A' + 10);
|
||||
if ('a' <= c && c <= 'f')
|
||||
cp += (ushort) (c - 'a' + 10);
|
||||
}
|
||||
vb.Append ((char) cp);
|
||||
break;
|
||||
default:
|
||||
throw XmlError ("Invalid JSON string literal; unexpected escape character");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int PeekChar ()
|
||||
|
||||
+12
-3
@@ -145,6 +145,7 @@ namespace System.Runtime.Serialization.Json
|
||||
var ret = root_type.Assembly.GetType (name, false) ?? Type.GetType (name, false);
|
||||
if (ret != null)
|
||||
return ret;
|
||||
#if !NET_2_1 // how to do that in ML?
|
||||
// We probably have to iterate all the existing
|
||||
// assemblies that are loaded in current domain.
|
||||
foreach (var ass in AppDomain.CurrentDomain.GetAssemblies ()) {
|
||||
@@ -152,6 +153,7 @@ namespace System.Runtime.Serialization.Json
|
||||
if (ret != null)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -239,9 +241,12 @@ namespace System.Runtime.Serialization.Json
|
||||
reader.ReadStartElement ();
|
||||
object ret;
|
||||
if (typeof (IList).IsAssignableFrom (collectionType)) {
|
||||
IList c = collectionType.IsArray ?
|
||||
new ArrayList () :
|
||||
(IList) Activator.CreateInstance (collectionType);
|
||||
#if NET_2_1
|
||||
Type listType = collectionType.IsArray ? typeof (List<>).MakeGenericType (elementType) : null;
|
||||
#else
|
||||
Type listType = collectionType.IsArray ? typeof (ArrayList) : null;
|
||||
#endif
|
||||
IList c = (IList) Activator.CreateInstance (listType ?? collectionType);
|
||||
for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
|
||||
if (!reader.IsStartElement ("item"))
|
||||
throw SerializationError (String.Format ("Expected element 'item', but found '{0}' in namespace '{1}'", reader.LocalName, reader.NamespaceURI));
|
||||
@@ -249,7 +254,11 @@ namespace System.Runtime.Serialization.Json
|
||||
object elem = ReadObject (et ?? typeof (object));
|
||||
c.Add (elem);
|
||||
}
|
||||
#if NET_2_1
|
||||
ret = c;
|
||||
#else
|
||||
ret = collectionType.IsArray ? ((ArrayList) c).ToArray (elementType) : c;
|
||||
#endif
|
||||
} else {
|
||||
object c = Activator.CreateInstance (collectionType);
|
||||
MethodInfo add = collectionType.GetMethod ("Add", new Type [] {elementType});
|
||||
|
||||
+7
-10
@@ -63,6 +63,7 @@ namespace System.Runtime.Serialization.Json
|
||||
if (graph == null) {
|
||||
if (top)
|
||||
GetTypeMap (root_type); // to make sure to reject invalid contracts
|
||||
writer.WriteString (null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,8 +77,7 @@ namespace System.Runtime.Serialization.Json
|
||||
case TypeCode.Single:
|
||||
case TypeCode.Double:
|
||||
case TypeCode.Decimal:
|
||||
if (always_emit_type)
|
||||
writer.WriteAttributeString ("type", "number");
|
||||
writer.WriteAttributeString ("type", "number");
|
||||
writer.WriteString (((IFormattable) graph).ToString ("R", CultureInfo.InvariantCulture));
|
||||
break;
|
||||
case TypeCode.Byte:
|
||||
@@ -88,15 +88,13 @@ namespace System.Runtime.Serialization.Json
|
||||
case TypeCode.UInt16:
|
||||
case TypeCode.UInt32:
|
||||
case TypeCode.UInt64:
|
||||
if (always_emit_type)
|
||||
writer.WriteAttributeString ("type", "number");
|
||||
writer.WriteAttributeString ("type", "number");
|
||||
if (graph.GetType ().IsEnum)
|
||||
graph = ((IConvertible) graph).ToType (Enum.GetUnderlyingType (graph.GetType ()), CultureInfo.InvariantCulture);
|
||||
writer.WriteString (((IFormattable) graph).ToString ("G", CultureInfo.InvariantCulture));
|
||||
break;
|
||||
case TypeCode.Boolean:
|
||||
if (always_emit_type)
|
||||
writer.WriteAttributeString ("type", "boolean");
|
||||
writer.WriteAttributeString ("type", "boolean");
|
||||
if ((bool) graph)
|
||||
writer.WriteString ("true");
|
||||
else
|
||||
@@ -124,10 +122,9 @@ namespace System.Runtime.Serialization.Json
|
||||
TypeMap tm = GetTypeMap (graph.GetType ());
|
||||
if (tm != null) {
|
||||
// FIXME: I'm not sure how it is determined whether __type is written or not...
|
||||
if (outputTypeName)
|
||||
if (outputTypeName || always_emit_type)
|
||||
writer.WriteAttributeString ("__type", FormatTypeName (graph.GetType ()));
|
||||
if (always_emit_type)
|
||||
writer.WriteAttributeString ("type", "object");
|
||||
writer.WriteAttributeString ("type", "object");
|
||||
tm.Serialize (this, graph);
|
||||
}
|
||||
else
|
||||
@@ -141,7 +138,7 @@ throw new InvalidDataContractException (String.Format ("Type {0} cannot be seria
|
||||
|
||||
string FormatTypeName (Type type)
|
||||
{
|
||||
return type.Namespace == null ? type.Name : String.Format ("{0}:#{1}", type.Name, type.Namespace);
|
||||
return String.Format ("{0}:#{1}", type.Name, type.Namespace);
|
||||
}
|
||||
|
||||
TypeMap GetTypeMap (Type type)
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace System.Runtime.Serialization.Json
|
||||
string attr_name, attr_value, runtime_type;
|
||||
Encoding encoding;
|
||||
byte [] encbuf = new byte [1024];
|
||||
bool no_string_yet = true, is_null;
|
||||
|
||||
public JsonWriter (Stream stream, Encoding encoding, bool closeOutput)
|
||||
{
|
||||
@@ -225,7 +226,13 @@ namespace System.Runtime.Serialization.Json
|
||||
throw new XmlException ("There is no open element to close");
|
||||
switch (element_kinds.Pop ()) {
|
||||
case ElementType.String:
|
||||
OutputAsciiChar ('"');
|
||||
if (!is_null) {
|
||||
if (no_string_yet)
|
||||
OutputAsciiChar ('"');
|
||||
OutputAsciiChar ('"');
|
||||
}
|
||||
no_string_yet = true;
|
||||
is_null = false;
|
||||
break;
|
||||
case ElementType.Array:
|
||||
OutputAsciiChar (']');
|
||||
@@ -314,11 +321,10 @@ namespace System.Runtime.Serialization.Json
|
||||
if (element_kinds.Peek () == ElementType.None) {
|
||||
element_kinds.Pop ();
|
||||
element_kinds.Push (ElementType.String);
|
||||
no_string_yet = true;
|
||||
is_null = false;
|
||||
}
|
||||
|
||||
if (element_kinds.Peek () == ElementType.String)
|
||||
OutputAsciiChar ('"');
|
||||
|
||||
first_content_flags.Push (true);
|
||||
|
||||
if (runtime_type != null) {
|
||||
@@ -345,9 +351,18 @@ namespace System.Runtime.Serialization.Json
|
||||
|
||||
if (state == WriteState.Attribute)
|
||||
attr_value += text;
|
||||
else {
|
||||
else if (text == null) {
|
||||
no_string_yet = false;
|
||||
is_null = true;
|
||||
OutputString ("null");
|
||||
} else {
|
||||
switch (element_kinds.Peek ()) {
|
||||
case ElementType.String:
|
||||
if (no_string_yet) {
|
||||
OutputAsciiChar ('"');
|
||||
no_string_yet = false;
|
||||
}
|
||||
break;
|
||||
case ElementType.Number:
|
||||
case ElementType.Boolean:
|
||||
break;
|
||||
|
||||
@@ -31,6 +31,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
@@ -57,9 +58,11 @@ namespace System.Runtime.Serialization.Json
|
||||
if (atts.Length == 1)
|
||||
return CreateTypeMap (type, (DataContractAttribute) atts [0]);
|
||||
|
||||
#if !NET_2_1
|
||||
atts = type.GetCustomAttributes (typeof (SerializableAttribute), false);
|
||||
if (atts.Length == 1)
|
||||
return CreateTypeMap (type, null);
|
||||
#endif
|
||||
|
||||
if (IsPrimitiveType (type))
|
||||
return null;
|
||||
@@ -84,16 +87,17 @@ namespace System.Runtime.Serialization.Json
|
||||
foreach (var pi in type.GetProperties ())
|
||||
if (pi.CanRead && pi.CanWrite)
|
||||
l.Add (new TypeMapProperty (pi, null));
|
||||
l.Sort ((x, y) => x.Order != y.Order ? x.Order - y.Order : String.Compare (x.Name, y.Name, StringComparison.Ordinal));
|
||||
return new TypeMap (type, null, l.ToArray ());
|
||||
}
|
||||
|
||||
static bool IsCollection (Type type)
|
||||
{
|
||||
if (type.GetInterface ("System.Collections.IList") != null)
|
||||
if (type.GetInterface ("System.Collections.IList", false) != null)
|
||||
return true;
|
||||
if (type.GetInterface ("System.Collections.Generic.IList`1") != null)
|
||||
if (type.GetInterface ("System.Collections.Generic.IList`1", false) != null)
|
||||
return true;
|
||||
if (type.GetInterface ("System.Collections.Generic.ICollection`1") != null)
|
||||
if (type.GetInterface ("System.Collections.Generic.ICollection`1", false) != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -113,7 +117,7 @@ namespace System.Runtime.Serialization.Json
|
||||
DataMemberAttribute dma = (DataMemberAttribute) atts [0];
|
||||
members.Add (new TypeMapField (fi, dma));
|
||||
} else {
|
||||
if (fi.GetCustomAttributes (typeof (NonSerializedAttribute), false).Length > 0)
|
||||
if (fi.GetCustomAttributes (typeof (IgnoreDataMemberAttribute), false).Length > 0)
|
||||
continue;
|
||||
members.Add (new TypeMapField (fi, null));
|
||||
}
|
||||
@@ -211,10 +215,9 @@ namespace System.Runtime.Serialization.Json
|
||||
get { return dma == null ? mi.Name : dma.Name ?? mi.Name; }
|
||||
}
|
||||
|
||||
// FIXME: Fill 3.5 member in s.r.serialization.
|
||||
// public bool EmitDefaultValue {
|
||||
// get { return dma != null && dma.EmitDefaultValue; }
|
||||
// }
|
||||
public bool EmitDefaultValue {
|
||||
get { return dma != null && dma.EmitDefaultValue; }
|
||||
}
|
||||
|
||||
public bool IsRequired {
|
||||
get { return dma != null && dma.IsRequired; }
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2009-10-09 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebScriptServiceHostFactory.cs : call base.OnOpening() here too.
|
||||
|
||||
2009-10-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebScriptServiceHostFactory.cs : I have to again revert the
|
||||
previous change; it does fill endpoints regardless of hosting
|
||||
environment (now with tests).
|
||||
|
||||
2009-09-17 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebScriptServiceHostFactory.cs : do tasks in previous change only
|
||||
|
||||
+11
@@ -55,6 +55,7 @@ namespace System.ServiceModel.Activation
|
||||
throw new ArgumentNullException ("serviceType");
|
||||
}
|
||||
|
||||
#if false
|
||||
protected override void ApplyConfiguration ()
|
||||
{
|
||||
base.ApplyConfiguration ();
|
||||
@@ -68,9 +69,19 @@ namespace System.ServiceModel.Activation
|
||||
AddServiceEndpoint (iface, new WebHttpBinding (), new Uri (String.Empty, UriKind.Relative));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void OnOpening ()
|
||||
{
|
||||
base.OnOpening ();
|
||||
|
||||
if (Description.Endpoints.Count == 0) {
|
||||
if (ImplementedContracts.Count > 1)
|
||||
throw new InvalidOperationException ("WebScriptServiceHostFactory does not allow more than one service contract in the service type");
|
||||
foreach (var pair in ImplementedContracts) // actually one
|
||||
AddServiceEndpoint (pair.Key, new WebHttpBinding (), new Uri (String.Empty, UriKind.Relative));
|
||||
}
|
||||
|
||||
foreach (ServiceEndpoint se in Description.Endpoints)
|
||||
if (se.Behaviors.Find<WebHttpBehavior> () == null)
|
||||
se.Behaviors.Add (new WebScriptEnablingBehavior ());
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-10-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebMessageEncodingBindingElement.cs, WebMessageEncoder.cs:
|
||||
add experimental monotouch build.
|
||||
|
||||
2009-09-17 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebMessageEncoder.cs : handle /js and /jsdebug specially, as raw
|
||||
|
||||
@@ -47,7 +47,11 @@ namespace System.ServiceModel.Channels
|
||||
}
|
||||
|
||||
public override string ContentType {
|
||||
#if NET_2_1
|
||||
get { return MediaType; }
|
||||
#else
|
||||
get { return MediaType + "; charset=" + source.WriteEncoding.HeaderName; }
|
||||
#endif
|
||||
}
|
||||
|
||||
// FIXME: find out how it can be customized.
|
||||
@@ -103,7 +107,11 @@ namespace System.ServiceModel.Channels
|
||||
break;
|
||||
case WebContentFormat.Json:
|
||||
// FIXME: is it safe/unsafe/required to keep XmlReader open?
|
||||
#if NET_2_1
|
||||
msg = Message.CreateMessage (MessageVersion.None, null, JsonReaderWriterFactory.CreateJsonReader (stream, source.ReaderQuotas));
|
||||
#else
|
||||
msg = Message.CreateMessage (MessageVersion.None, null, JsonReaderWriterFactory.CreateJsonReader (stream, enc, source.ReaderQuotas, null));
|
||||
#endif
|
||||
wp = new WebBodyFormatMessageProperty (WebContentFormat.Json);
|
||||
break;
|
||||
case WebContentFormat.Raw:
|
||||
@@ -156,8 +164,13 @@ namespace System.ServiceModel.Channels
|
||||
|
||||
switch (GetContentFormat (message)) {
|
||||
case WebContentFormat.Xml:
|
||||
#if NET_2_1
|
||||
using (XmlWriter w = XmlDictionaryWriter.CreateDictionaryWriter (XmlWriter.Create (new StreamWriter (stream, source.WriteEncoding))))
|
||||
message.WriteMessage (w);
|
||||
#else
|
||||
using (XmlWriter w = XmlDictionaryWriter.CreateTextWriter (stream, source.WriteEncoding))
|
||||
message.WriteMessage (w);
|
||||
#endif
|
||||
break;
|
||||
case WebContentFormat.Json:
|
||||
using (XmlWriter w = JsonReaderWriterFactory.CreateJsonWriter (stream, source.WriteEncoding))
|
||||
|
||||
+10
@@ -34,7 +34,11 @@ using System.Xml;
|
||||
namespace System.ServiceModel.Channels
|
||||
{
|
||||
public sealed class WebMessageEncodingBindingElement
|
||||
#if NET_2_1
|
||||
: MessageEncodingBindingElement
|
||||
#else
|
||||
: MessageEncodingBindingElement, IWsdlExportExtension
|
||||
#endif
|
||||
{
|
||||
Encoding write_encoding;
|
||||
XmlDictionaryReaderQuotas reader_quotas;
|
||||
@@ -53,7 +57,9 @@ namespace System.ServiceModel.Channels
|
||||
if (writeEncoding == null)
|
||||
throw new ArgumentNullException ("writeEncoding");
|
||||
WriteEncoding = writeEncoding;
|
||||
#if !NET_2_1
|
||||
reader_quotas = new XmlDictionaryReaderQuotas ();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Properties
|
||||
@@ -108,6 +114,7 @@ namespace System.ServiceModel.Channels
|
||||
return base.BuildChannelFactory<TChannel> (context);
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
[MonoTODO ("Why is it overriden?")]
|
||||
public override bool CanBuildChannelListener<TChannel> (BindingContext context)
|
||||
{
|
||||
@@ -123,6 +130,7 @@ namespace System.ServiceModel.Channels
|
||||
context.RemainingBindingElements.Add (this);
|
||||
return base.BuildChannelListener<TChannel> (context);
|
||||
}
|
||||
#endif
|
||||
|
||||
public override BindingElement Clone ()
|
||||
{
|
||||
@@ -141,6 +149,7 @@ namespace System.ServiceModel.Channels
|
||||
return context.GetInnerProperty<T> ();
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
[MonoTODO]
|
||||
void IWsdlExportExtension.ExportContract (WsdlExporter exporter, WsdlContractConversionContext context)
|
||||
{
|
||||
@@ -152,5 +161,6 @@ namespace System.ServiceModel.Channels
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-10-02 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebHttpElement.cs, WebScriptEnablingElement.cs : fix BehavirType.
|
||||
|
||||
2008-02-20 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebHttpBindingElement.cs : fix build.
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ namespace System.ServiceModel.Configuration
|
||||
}
|
||||
|
||||
public override Type BehaviorType {
|
||||
get { return (Type) base [behavior_type]; }
|
||||
get { return typeof (WebHttpBehavior); }
|
||||
}
|
||||
|
||||
protected internal override object CreateBehavior ()
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ namespace System.ServiceModel.Configuration
|
||||
// Properties
|
||||
|
||||
public override Type BehaviorType {
|
||||
get { return (Type) base [behavior_type]; }
|
||||
get { return typeof (WebScriptEnablingBehavior); }
|
||||
}
|
||||
|
||||
protected internal override object CreateBehavior ()
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
2009-10-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebHttpBehavior.cs : add experimental monotouch build.
|
||||
|
||||
2009-10-08 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebScriptEnablingBehavior.cs : use JsonQueryStringConverter, with
|
||||
"d" wrapper name. Allow only WrappedRequest.
|
||||
|
||||
2009-10-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebScriptEnablingBehavior.cs : validate body style.
|
||||
* WebHttpBehavior.cs : operations could miss WebGet/WebInvoke and
|
||||
we should not crash by NRE because of missing of those atts.
|
||||
|
||||
2009-10-06 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebScriptEnablingBehavior.cs : fix listen uri which used to result
|
||||
in unexpected relative recalculation against the base uri.
|
||||
|
||||
2009-09-18 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebHttpBehavior.cs : parameter Wrapped check in Validate() should
|
||||
|
||||
+30
-3
@@ -38,6 +38,16 @@ namespace System.ServiceModel.Description
|
||||
{
|
||||
public static WebAttributeInfo GetWebAttributeInfo (this OperationDescription od)
|
||||
{
|
||||
#if NET_2_1
|
||||
var mi = od.BeginMethod ?? od.SyncMethod;
|
||||
var atts = mi.GetCustomAttributes (typeof (WebGetAttribute), true);
|
||||
if (atts.Length == 1)
|
||||
return ((WebGetAttribute) atts [0]).Info;
|
||||
atts = mi.GetCustomAttributes (typeof (WebInvokeAttribute), true);
|
||||
if (atts.Length == 1)
|
||||
return ((WebInvokeAttribute) atts [0]).Info;
|
||||
return null;
|
||||
#else
|
||||
foreach (IOperationBehavior ob in od.Behaviors) {
|
||||
WebAttributeInfo info = null;
|
||||
var wg = ob as WebGetAttribute;
|
||||
@@ -47,11 +57,15 @@ namespace System.ServiceModel.Description
|
||||
if (wi != null)
|
||||
return wi.Info;
|
||||
}
|
||||
return null;
|
||||
return new WebGetAttribute ().Info; // blank one
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public class WebHttpBehavior : IEndpointBehavior
|
||||
public class WebHttpBehavior
|
||||
#if !NET_2_1
|
||||
: IEndpointBehavior
|
||||
#endif
|
||||
{
|
||||
public WebHttpBehavior ()
|
||||
{
|
||||
@@ -77,23 +91,29 @@ namespace System.ServiceModel.Description
|
||||
// clientRuntime.MessageInspectors.Add (something);
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
[MonoTODO]
|
||||
protected virtual void AddServerErrorHandlers (ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
|
||||
{
|
||||
// endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add (something);
|
||||
}
|
||||
#endif
|
||||
|
||||
public virtual void ApplyClientBehavior (ServiceEndpoint endpoint, ClientRuntime clientRuntime)
|
||||
{
|
||||
AddClientErrorInspector (endpoint, clientRuntime);
|
||||
|
||||
#if NET_2_1 && !MONOTOUCH
|
||||
throw new NotSupportedException ("Due to the lack of ClientRuntime.Operations, Silverlight cannot support this binding.");
|
||||
#else
|
||||
foreach (ClientOperation oper in clientRuntime.Operations) {
|
||||
var req = GetRequestClientFormatter (endpoint.Contract.Operations.Find (oper.Name), endpoint);
|
||||
var res = GetReplyClientFormatter (endpoint.Contract.Operations.Find (oper.Name), endpoint);
|
||||
oper.Formatter = new ClientPairFormatter (req, res);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
public virtual void ApplyDispatchBehavior (ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
|
||||
{
|
||||
endpointDispatcher.DispatchRuntime.OperationSelector = GetOperationSelector (endpoint);
|
||||
@@ -108,6 +128,7 @@ namespace System.ServiceModel.Description
|
||||
oper.Formatter = new DispatchPairFormatter (req, res);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal class ClientPairFormatter : IClientMessageFormatter
|
||||
{
|
||||
@@ -130,6 +151,7 @@ namespace System.ServiceModel.Description
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
internal class DispatchPairFormatter : IDispatchMessageFormatter
|
||||
{
|
||||
public DispatchPairFormatter (IDispatchMessageFormatter request, IDispatchMessageFormatter reply)
|
||||
@@ -156,6 +178,7 @@ namespace System.ServiceModel.Description
|
||||
{
|
||||
return new WebHttpDispatchOperationSelector (endpoint);
|
||||
}
|
||||
#endif
|
||||
|
||||
protected virtual QueryStringConverter GetQueryStringConverter (OperationDescription operationDescription)
|
||||
{
|
||||
@@ -167,20 +190,24 @@ namespace System.ServiceModel.Description
|
||||
return new WebMessageFormatter.ReplyClientFormatter (operationDescription, endpoint, GetQueryStringConverter (operationDescription), this);
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
protected virtual IDispatchMessageFormatter GetReplyDispatchFormatter (OperationDescription operationDescription, ServiceEndpoint endpoint)
|
||||
{
|
||||
return new WebMessageFormatter.ReplyDispatchFormatter (operationDescription, endpoint, GetQueryStringConverter (operationDescription), this);
|
||||
}
|
||||
#endif
|
||||
|
||||
protected virtual IClientMessageFormatter GetRequestClientFormatter (OperationDescription operationDescription, ServiceEndpoint endpoint)
|
||||
{
|
||||
return new WebMessageFormatter.RequestClientFormatter (operationDescription, endpoint, GetQueryStringConverter (operationDescription), this);
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
protected virtual IDispatchMessageFormatter GetRequestDispatchFormatter (OperationDescription operationDescription, ServiceEndpoint endpoint)
|
||||
{
|
||||
return new WebMessageFormatter.RequestDispatchFormatter (operationDescription, endpoint, GetQueryStringConverter (operationDescription), this);
|
||||
}
|
||||
#endif
|
||||
|
||||
[MonoTODO ("check UriTemplate validity")]
|
||||
public virtual void Validate (ServiceEndpoint endpoint)
|
||||
|
||||
+15
-11
@@ -94,8 +94,8 @@ namespace System.ServiceModel.Description
|
||||
base.ApplyDispatchBehavior (endpoint, endpointDispatcher);
|
||||
|
||||
// doing similar to ServiceMetadataExtension
|
||||
BuildScriptDispatcher (endpoint, endpointDispatcher, "/js", false);
|
||||
BuildScriptDispatcher (endpoint, endpointDispatcher, "/jsdebug", true);
|
||||
BuildScriptDispatcher (endpoint, endpointDispatcher, "js", false);
|
||||
BuildScriptDispatcher (endpoint, endpointDispatcher, "jsdebug", true);
|
||||
}
|
||||
|
||||
void BuildScriptDispatcher (ServiceEndpoint endpoint, EndpointDispatcher ed, string subPath, bool debug)
|
||||
@@ -103,11 +103,14 @@ namespace System.ServiceModel.Description
|
||||
var instance = new InteropScriptService (endpoint.Contract.ContractType, endpoint.Address.Uri.ToString (), debug);
|
||||
|
||||
var cdOrg = ed.ChannelDispatcher;
|
||||
var uri = new Uri (cdOrg.Listener.Uri, subPath);
|
||||
var cd = new ChannelDispatcher (endpoint.Binding.BuildChannelListener<IReplyChannel> (uri), String.Empty);
|
||||
var baseUriString = endpoint.ListenUri.ToString ();
|
||||
var uri = new Uri (String.Concat (baseUriString, baseUriString [baseUriString.Length - 1] == '/' ? String.Empty : "/", subPath));
|
||||
var listener = endpoint.Binding.BuildChannelListener<IReplyChannel> (uri);
|
||||
var cd = new ChannelDispatcher (listener, String.Empty);
|
||||
cd.MessageVersion = MessageVersion.None;
|
||||
|
||||
cd.Endpoints.Add (new EndpointDispatcher (new EndpointAddress (uri), "InteropScriptService", String.Empty));
|
||||
cd.Endpoints.Add (new EndpointDispatcher (new EndpointAddress (uri), "InteropScriptService", String.Empty)
|
||||
{ ContractFilter = new MatchAllMessageFilter () });
|
||||
|
||||
var dr = cd.Endpoints [0].DispatchRuntime;
|
||||
var dop = new DispatchOperation (dr, "Get", "*", "*");
|
||||
@@ -161,10 +164,9 @@ namespace System.ServiceModel.Description
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected override QueryStringConverter GetQueryStringConverter (OperationDescription operationDescription)
|
||||
{
|
||||
return base.GetQueryStringConverter (operationDescription);
|
||||
return new JsonQueryStringConverter () { CustomWrapperName = "d"};
|
||||
}
|
||||
|
||||
[MonoTODO ("add non-XmlSerializer-ness check (but where?)")]
|
||||
@@ -175,13 +177,11 @@ namespace System.ServiceModel.Description
|
||||
ValidateBinding (endpoint);
|
||||
|
||||
foreach (var od in endpoint.Contract.Operations) {
|
||||
var wga = od.Behaviors.Find<WebGetAttribute> ();
|
||||
if (wga != null && wga.UriTemplate != null)
|
||||
var wai = od.GetWebAttributeInfo ();
|
||||
if (wai.UriTemplate != null)
|
||||
throw new InvalidOperationException ("UriTemplate must not be used with WebScriptEnablingBehavior");
|
||||
var wia = od.Behaviors.Find<WebInvokeAttribute> ();
|
||||
if (wia != null) {
|
||||
if (wia.UriTemplate != null)
|
||||
throw new InvalidOperationException ("UriTemplate must not be used with WebScriptEnablingBehavior");
|
||||
switch (wia.Method.ToUpper ()) {
|
||||
case "GET":
|
||||
case "POST":
|
||||
@@ -190,6 +190,10 @@ namespace System.ServiceModel.Description
|
||||
throw new InvalidOperationException ("Only GET and POST HTTP methods are valid used for WebScriptEnablingBehavior");
|
||||
}
|
||||
}
|
||||
|
||||
var style = wai != null && wai.IsBodyStyleSetExplicitly ? wai.BodyStyle : DefaultBodyStyle;
|
||||
if (style != WebMessageBodyStyle.WrappedRequest)
|
||||
throw new NotSupportedException (String.Format ("WebScriptEnableBehavior only allows WrappedRequest body style, but operation '{0}' uses {1}.", od.Name, style));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,42 @@
|
||||
2009-10-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* JsonQueryStringConverter.cs
|
||||
QueryStringConverter.cs
|
||||
WebMessageFormatter.cs : add experimental monotouch build.
|
||||
|
||||
2009-10-08 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebMessageEncoder.cs : use alwaysEmitTypeInformation to output
|
||||
object __type.
|
||||
|
||||
2009-10-08 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* JsonQueryStringConverter.cs : add custom body name support (used.
|
||||
for AJAX). Handle string value (in very LAMESPEC way).
|
||||
* WebMessageFormatter.cs : add custom body name support.
|
||||
Slightly changed reply serialization.
|
||||
Convert deserialized values using QueryStringConverter.
|
||||
|
||||
2009-10-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebMessageFormatter.cs : revert and fix wrapper name change. XML
|
||||
and JSON have different serialization.
|
||||
|
||||
2009-10-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebMessageFormatter.cs : also fix wrapped message deserialization.
|
||||
It should expect FooResponse (body WrapperName), not FooResult
|
||||
(ReturnValue part Name).
|
||||
|
||||
2009-10-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebMessageFormatter.cs : when they serialize Wrapped message, it
|
||||
first writes "root" and then the wrapper element.
|
||||
|
||||
2009-10-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebMessageFormatter.cs : JSON writer does not support namespace.
|
||||
|
||||
2009-09-02 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebMessageFormatter.cs : it was not returning value with correct
|
||||
|
||||
+14
-3
@@ -40,6 +40,8 @@ namespace System.ServiceModel.Dispatcher
|
||||
{
|
||||
DataContractJsonSerializer serializer = new DataContractJsonSerializer (typeof (object));
|
||||
|
||||
internal string CustomWrapperName { get; set; }
|
||||
|
||||
public override bool CanConvert (Type type)
|
||||
{
|
||||
// almost copy from QueryStringConverter, except that DBNull and XmlQualifiedName are supported
|
||||
@@ -79,10 +81,19 @@ namespace System.ServiceModel.Dispatcher
|
||||
// the target type in JSON context.
|
||||
|
||||
switch (Type.GetTypeCode (parameterType)) {
|
||||
//case TypeCode.String:
|
||||
// return parameter;
|
||||
case TypeCode.String:
|
||||
// LAMESPEC LAMESPEC LAMESPEC: we cannot give "foo" as the string value input (even if they are escaped as %22!)
|
||||
if (parameter == null)
|
||||
return null;
|
||||
if (parameter.Length > 1 && parameter [0] == '"' && parameter [parameter.Length - 1] == '"')
|
||||
return parameter.Substring (1, parameter.Length - 2);
|
||||
else if (parameter [0] != '"')
|
||||
return parameter;
|
||||
break;
|
||||
#if !NET_2_1
|
||||
case TypeCode.Char:
|
||||
return parameter != null ? Char.Parse (parameter): default (char);
|
||||
#endif
|
||||
case TypeCode.SByte:
|
||||
return parameter != null ? SByte.Parse (parameter, CultureInfo.InvariantCulture): default (sbyte);
|
||||
case TypeCode.Byte:
|
||||
@@ -163,7 +174,7 @@ namespace System.ServiceModel.Dispatcher
|
||||
parameter.ToString ();
|
||||
StringBuilder sb = new StringBuilder (s);
|
||||
sb.Replace ("\"", "\\\"");
|
||||
sb.Insert (0, '\"');
|
||||
sb.Insert (0, "\"");
|
||||
sb.Append ('\"');
|
||||
return sb.ToString ();
|
||||
default:
|
||||
|
||||
+3
-1
@@ -71,8 +71,10 @@ namespace System.ServiceModel.Dispatcher
|
||||
switch (Type.GetTypeCode (parameterType)) {
|
||||
case TypeCode.String:
|
||||
return parameter;
|
||||
#if !NET_2_1
|
||||
case TypeCode.Char:
|
||||
return parameter != null ? Char.Parse (parameter): default (char);
|
||||
return parameter != null ? Char.Parse (parameter) : default (char);
|
||||
#endif
|
||||
case TypeCode.SByte:
|
||||
return parameter != null ? SByte.Parse (parameter, CultureInfo.InvariantCulture): default (sbyte);
|
||||
case TypeCode.Byte:
|
||||
|
||||
+67
-19
@@ -26,7 +26,8 @@
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Json;
|
||||
@@ -55,6 +56,10 @@ namespace System.ServiceModel.Description
|
||||
this.converter = converter;
|
||||
this.behavior = behavior;
|
||||
ApplyWebAttribute ();
|
||||
// This is a hack for WebScriptEnablingBehavior
|
||||
var jqc = converter as JsonQueryStringConverter;
|
||||
if (jqc != null)
|
||||
BodyName = jqc.CustomWrapperName;
|
||||
}
|
||||
|
||||
void ApplyWebAttribute ()
|
||||
@@ -73,6 +78,8 @@ namespace System.ServiceModel.Description
|
||||
template = info.BuildUriTemplate (Operation, GetMessageDescription (MessageDirection.Input));
|
||||
}
|
||||
|
||||
public string BodyName { get; set; }
|
||||
|
||||
public WebHttpBehavior Behavior {
|
||||
get { return behavior; }
|
||||
}
|
||||
@@ -92,7 +99,7 @@ namespace System.ServiceModel.Description
|
||||
case WebMessageBodyStyle.WrappedResponse:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return BodyName != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,9 +157,12 @@ namespace System.ServiceModel.Description
|
||||
return GetSerializer (ref xml_serializer, p => new DataContractSerializer (p.Type));
|
||||
break;
|
||||
case WebContentFormat.Json:
|
||||
// FIXME: after name argument they are hack
|
||||
#if !NET_2_1 || MONOTOUCH
|
||||
if (IsResponseBodyWrapped)
|
||||
return GetSerializer (ref json_serializer, p => new DataContractJsonSerializer (p.Type, p.Name));
|
||||
return GetSerializer (ref json_serializer, p => new DataContractJsonSerializer (p.Type, BodyName ?? p.Name, null, 0x100000, false, null, true));
|
||||
else
|
||||
#endif
|
||||
return GetSerializer (ref json_serializer, p => new DataContractJsonSerializer (p.Type));
|
||||
break;
|
||||
default:
|
||||
@@ -197,6 +207,7 @@ namespace System.ServiceModel.Description
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
internal class RequestDispatchFormatter : WebDispatchMessageFormatter
|
||||
{
|
||||
public RequestDispatchFormatter (OperationDescription operation, ServiceEndpoint endpoint, QueryStringConverter converter, WebHttpBehavior behavior)
|
||||
@@ -222,6 +233,7 @@ namespace System.ServiceModel.Description
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal abstract class WebClientMessageFormatter : WebMessageFormatter, IClientMessageFormatter
|
||||
{
|
||||
@@ -236,7 +248,7 @@ namespace System.ServiceModel.Description
|
||||
throw new ArgumentNullException ("parameters");
|
||||
CheckMessageVersion (messageVersion);
|
||||
|
||||
var c = new NameValueCollection ();
|
||||
var c = new Dictionary<string,string> ();
|
||||
|
||||
MessageDescription md = GetMessageDescription (MessageDirection.Input);
|
||||
|
||||
@@ -245,7 +257,7 @@ namespace System.ServiceModel.Description
|
||||
|
||||
for (int i = 0; i < parameters.Length; i++) {
|
||||
var p = md.Body.Parts [i];
|
||||
string name = p.Name.ToUpperInvariant ();
|
||||
string name = p.Name.ToUpper (CultureInfo.InvariantCulture);
|
||||
if (UriTemplate.PathSegmentVariableNames.Contains (name) ||
|
||||
UriTemplate.QueryValueVariableNames.Contains (name))
|
||||
c.Add (name, parameters [i] != null ? Converter.ConvertValueToString (parameters [i], parameters [i].GetType ()) : null);
|
||||
@@ -262,9 +274,10 @@ namespace System.ServiceModel.Description
|
||||
var hp = new HttpRequestMessageProperty ();
|
||||
hp.Method = Info.Method;
|
||||
|
||||
// FIXME: isn't it always null?
|
||||
#if !NET_2_1
|
||||
if (WebOperationContext.Current != null)
|
||||
WebOperationContext.Current.OutgoingRequest.Apply (hp);
|
||||
#endif
|
||||
// FIXME: set hp.SuppressEntityBody for some cases.
|
||||
ret.Properties.Add (HttpRequestMessageProperty.Name, hp);
|
||||
|
||||
@@ -293,12 +306,16 @@ namespace System.ServiceModel.Description
|
||||
|
||||
var reader = message.GetReaderAtBodyContents ();
|
||||
|
||||
if (IsResponseBodyWrapped && md.Body.WrapperName != null)
|
||||
reader.ReadStartElement (md.Body.WrapperName, md.Body.WrapperNamespace);
|
||||
if (IsResponseBodyWrapped) {
|
||||
if (wp.Format == WebContentFormat.Json)
|
||||
reader.ReadStartElement ("root", String.Empty); // note that the wrapper name is passed to the serializer.
|
||||
else
|
||||
reader.ReadStartElement (md.Body.WrapperName, md.Body.WrapperNamespace);
|
||||
}
|
||||
|
||||
var ret = serializer.ReadObject (reader, false);
|
||||
var ret = serializer.ReadObject (reader, true);
|
||||
|
||||
if (IsResponseBodyWrapped && md.Body.WrapperName != null)
|
||||
if (IsResponseBodyWrapped)
|
||||
reader.ReadEndElement ();
|
||||
|
||||
return ret;
|
||||
@@ -307,25 +324,48 @@ namespace System.ServiceModel.Description
|
||||
|
||||
internal class WrappedBodyWriter : BodyWriter
|
||||
{
|
||||
public WrappedBodyWriter (object value, XmlObjectSerializer serializer, string name, string ns)
|
||||
public WrappedBodyWriter (object value, XmlObjectSerializer serializer, string name, string ns, bool json)
|
||||
: base (true)
|
||||
{
|
||||
this.name = name;
|
||||
this.ns = ns;
|
||||
this.value = value;
|
||||
this.serializer = serializer;
|
||||
this.is_json = json;
|
||||
}
|
||||
|
||||
bool is_json;
|
||||
string name, ns;
|
||||
object value;
|
||||
XmlObjectSerializer serializer;
|
||||
|
||||
#if !NET_2_1
|
||||
protected override BodyWriter OnCreateBufferedCopy (int maxBufferSize)
|
||||
{
|
||||
return new WrappedBodyWriter (value, serializer, name, ns);
|
||||
return new WrappedBodyWriter (value, serializer, name, ns, is_json);
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void OnWriteBodyContents (XmlDictionaryWriter writer)
|
||||
{
|
||||
if (is_json)
|
||||
WriteJsonBodyContents (writer);
|
||||
else
|
||||
WriteXmlBodyContents (writer);
|
||||
}
|
||||
|
||||
void WriteJsonBodyContents (XmlDictionaryWriter writer)
|
||||
{
|
||||
if (name != null) {
|
||||
writer.WriteStartElement ("root");
|
||||
writer.WriteAttributeString ("type", "object");
|
||||
}
|
||||
serializer.WriteObject (writer, value);
|
||||
if (name != null)
|
||||
writer.WriteEndElement ();
|
||||
}
|
||||
|
||||
void WriteXmlBodyContents (XmlDictionaryWriter writer)
|
||||
{
|
||||
if (name != null)
|
||||
writer.WriteStartElement (name, ns);
|
||||
@@ -335,6 +375,7 @@ namespace System.ServiceModel.Description
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
internal abstract class WebDispatchMessageFormatter : WebMessageFormatter, IDispatchMessageFormatter
|
||||
{
|
||||
protected WebDispatchMessageFormatter (OperationDescription operation, ServiceEndpoint endpoint, QueryStringConverter converter, WebHttpBehavior behavior)
|
||||
@@ -370,23 +411,28 @@ namespace System.ServiceModel.Description
|
||||
|
||||
string mediaType = null;
|
||||
XmlObjectSerializer serializer = null;
|
||||
|
||||
// FIXME: serialize ref/out parameters as well.
|
||||
|
||||
string name = null, ns = null;
|
||||
|
||||
switch (msgfmt) {
|
||||
case WebMessageFormat.Xml:
|
||||
serializer = GetSerializer (WebContentFormat.Xml);
|
||||
mediaType = "application/xml";
|
||||
name = IsResponseBodyWrapped ? md.Body.WrapperName : null;
|
||||
ns = IsResponseBodyWrapped ? md.Body.WrapperNamespace : null;
|
||||
break;
|
||||
case WebMessageFormat.Json:
|
||||
serializer = GetSerializer (WebContentFormat.Json);
|
||||
mediaType = "application/json";
|
||||
name = IsResponseBodyWrapped ? (BodyName ?? md.Body.ReturnValue.Name) : null;
|
||||
ns = String.Empty;
|
||||
break;
|
||||
}
|
||||
|
||||
// FIXME: serialize ref/out parameters as well.
|
||||
|
||||
string name = IsResponseBodyWrapped ? md.Body.WrapperName : null;
|
||||
string ns = IsResponseBodyWrapped ? md.Body.WrapperNamespace : null;
|
||||
|
||||
Message ret = Message.CreateMessage (MessageVersion.None, null, new WrappedBodyWriter (result, serializer, name, ns));
|
||||
bool json = msgfmt == WebMessageFormat.Json;
|
||||
Message ret = Message.CreateMessage (MessageVersion.None, null, new WrappedBodyWriter (result, serializer, name, ns, json));
|
||||
|
||||
// Message properties
|
||||
|
||||
@@ -428,9 +474,11 @@ namespace System.ServiceModel.Description
|
||||
for (int i = 0; i < parameters.Length; i++) {
|
||||
var p = md.Body.Parts [i];
|
||||
string name = p.Name.ToUpperInvariant ();
|
||||
parameters [i] = match.BoundVariables [name];
|
||||
var str = match.BoundVariables [name];
|
||||
parameters [i] = Converter.ConvertStringToValue (str, p.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -106,9 +106,9 @@ namespace System.ServiceModel.Syndication
|
||||
|
||||
protected virtual SyndicationItem ReadItem (XmlReader reader, SyndicationFeed feed)
|
||||
{
|
||||
SyndicationItem item = feed.CreateItem ();
|
||||
new Atom10ItemFormatter (item).ReadFrom (reader);
|
||||
return item;
|
||||
Atom10ItemFormatter formatter = new Atom10ItemFormatter ();
|
||||
formatter.ReadFrom (reader);
|
||||
return formatter.Item;
|
||||
}
|
||||
|
||||
protected virtual IEnumerable<SyndicationItem> ReadItems (XmlReader reader, SyndicationFeed feed, out bool areAllItemsRead)
|
||||
|
||||
+2
-6
@@ -184,9 +184,7 @@ namespace System.ServiceModel.Syndication
|
||||
Item.Links.Add (l);
|
||||
continue;
|
||||
case "published":
|
||||
// FIXME: somehow DateTimeOffset causes the runtime crash.
|
||||
reader.ReadElementContentAsString ();
|
||||
// Item.PublishDate = XmlConvert.ToDateTimeOffset (reader.ReadElementContentAsString ());
|
||||
Item.PublishDate = XmlConvert.ToDateTimeOffset (reader.ReadElementContentAsString ());
|
||||
continue;
|
||||
case "rights":
|
||||
Item.Copyright = ReadTextSyndicationContent (reader);
|
||||
@@ -201,9 +199,7 @@ namespace System.ServiceModel.Syndication
|
||||
Item.Title = ReadTextSyndicationContent (reader);
|
||||
continue;
|
||||
case "updated":
|
||||
// FIXME: somehow DateTimeOffset causes the runtime crash.
|
||||
reader.ReadElementContentAsString ();
|
||||
// Item.LastUpdatedTime = XmlConvert.ToDateTimeOffset (reader.ReadElementContentAsString ());
|
||||
Item.LastUpdatedTime = XmlConvert.ToDateTimeOffset (reader.ReadElementContentAsString ());
|
||||
continue;
|
||||
|
||||
// Atom 1.0 does not specify "content" element, but it is required to distinguish Content property from extension elements.
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
2009-10-16 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Rss20FeedFormatter.cs, Rss20ItemFormatter.cs : handle other text
|
||||
nodes than text (cdata, whitespaces etc.) and make sure to proceed
|
||||
the reader when they are skipped. Fixed bug #546965 and #546959.
|
||||
|
||||
2009-10-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* SyndicationVersions.cs :
|
||||
Handle atom feed as well. Patch by David Mitchell.
|
||||
|
||||
2009-10-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* SyndicationElementExtension.cs : give OuterName and OuterNamespace
|
||||
for extensions with .ctor(XmlReader).
|
||||
|
||||
2009-10-05 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Atom10FeedFormatter.cs : do not use Atom10ItemFormatter(item)
|
||||
at ReadItem(). It is only for writing. Patch by David Mitchell.
|
||||
|
||||
2009-10-05 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Atom10ItemFormatter.cs : enable XmlConvert.ToDateTimeOffset(),
|
||||
patch by David Mitchell.
|
||||
|
||||
2009-09-15 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* SyndicationElementExtension.cs : make it ready for 2.1 build.
|
||||
|
||||
+3
-3
@@ -305,7 +305,7 @@ namespace System.ServiceModel.Syndication
|
||||
if (!reader.IsEmptyElement) {
|
||||
reader.Read ();
|
||||
for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
|
||||
if (reader.NodeType == XmlNodeType.Text)
|
||||
if (reader.IsTextNode ())
|
||||
category.Name += reader.Value;
|
||||
else if (!TryParseElement (reader, category, Version)) {
|
||||
if (PreserveElementExtensions)
|
||||
@@ -336,7 +336,7 @@ namespace System.ServiceModel.Syndication
|
||||
string url = null;
|
||||
reader.Read ();
|
||||
for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
|
||||
if (reader.NodeType == XmlNodeType.Text)
|
||||
if (reader.IsTextNode ())
|
||||
url += reader.Value;
|
||||
else if (!TryParseElement (reader, link, Version)) {
|
||||
if (PreserveElementExtensions)
|
||||
@@ -367,7 +367,7 @@ namespace System.ServiceModel.Syndication
|
||||
if (!reader.IsEmptyElement) {
|
||||
reader.Read ();
|
||||
for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
|
||||
if (reader.NodeType == XmlNodeType.Text)
|
||||
if (reader.IsTextNode ())
|
||||
person.Email += reader.Value;
|
||||
else if (!TryParseElement (reader, person, Version)) {
|
||||
if (PreserveElementExtensions)
|
||||
|
||||
+26
-5
@@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
@@ -38,6 +39,21 @@ using System.Xml.Serialization;
|
||||
|
||||
namespace System.ServiceModel.Syndication
|
||||
{
|
||||
static class XmlReaderExtensions
|
||||
{
|
||||
public static bool IsTextNode (this XmlReader r)
|
||||
{
|
||||
switch (r.NodeType) {
|
||||
case XmlNodeType.Text:
|
||||
case XmlNodeType.CDATA:
|
||||
case XmlNodeType.Whitespace:
|
||||
case XmlNodeType.SignificantWhitespace:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlRoot ("item", Namespace = "")]
|
||||
public class Rss20ItemFormatter : SyndicationItemFormatter, IXmlSerializable
|
||||
{
|
||||
@@ -285,7 +301,7 @@ namespace System.ServiceModel.Syndication
|
||||
if (!reader.IsEmptyElement) {
|
||||
reader.Read ();
|
||||
for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
|
||||
if (reader.NodeType == XmlNodeType.Text)
|
||||
if (reader.IsTextNode ())
|
||||
category.Name += reader.Value;
|
||||
else if (!TryParseElement (reader, category, Version)) {
|
||||
if (PreserveElementExtensions)
|
||||
@@ -294,6 +310,7 @@ namespace System.ServiceModel.Syndication
|
||||
else
|
||||
reader.Skip ();
|
||||
}
|
||||
reader.Read ();
|
||||
}
|
||||
}
|
||||
reader.Read (); // </category> or <category ... />
|
||||
@@ -362,7 +379,7 @@ namespace System.ServiceModel.Syndication
|
||||
string url = null;
|
||||
reader.Read ();
|
||||
for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
|
||||
if (reader.NodeType == XmlNodeType.Text)
|
||||
if (reader.IsTextNode ())
|
||||
url += reader.Value;
|
||||
else if (!TryParseElement (reader, link, Version)) {
|
||||
if (PreserveElementExtensions)
|
||||
@@ -393,7 +410,7 @@ namespace System.ServiceModel.Syndication
|
||||
if (!reader.IsEmptyElement) {
|
||||
reader.Read ();
|
||||
for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
|
||||
if (reader.NodeType == XmlNodeType.Text)
|
||||
if (reader.IsTextNode ())
|
||||
person.Email += reader.Value;
|
||||
else if (!TryParseElement (reader, person, Version)) {
|
||||
if (PreserveElementExtensions)
|
||||
@@ -402,6 +419,7 @@ namespace System.ServiceModel.Syndication
|
||||
else
|
||||
reader.Skip ();
|
||||
}
|
||||
reader.Read ();
|
||||
}
|
||||
}
|
||||
reader.Read (); // end element or empty element
|
||||
@@ -468,9 +486,12 @@ namespace System.ServiceModel.Syndication
|
||||
if (!reader.IsEmptyElement) {
|
||||
reader.Read ();
|
||||
string title = null;
|
||||
while (reader.NodeType != XmlNodeType.EndElement)
|
||||
if (reader.NodeType == XmlNodeType.Text)
|
||||
while (reader.NodeType != XmlNodeType.EndElement) {
|
||||
if (reader.IsTextNode ())
|
||||
title += reader.Value;
|
||||
reader.Skip ();
|
||||
reader.MoveToContent ();
|
||||
}
|
||||
feed.Title = new TextSyndicationContent (title);
|
||||
}
|
||||
reader.Read (); // </source> or <source ... />
|
||||
|
||||
+8
-19
@@ -122,13 +122,9 @@ namespace System.ServiceModel.Syndication
|
||||
|
||||
abstract class ReadWriteHandler
|
||||
{
|
||||
public virtual string Name {
|
||||
get { return null; }
|
||||
}
|
||||
public string Name { get; protected set; }
|
||||
|
||||
public virtual string Namespace {
|
||||
get { return null; }
|
||||
}
|
||||
public string Namespace { get; protected set; }
|
||||
|
||||
public virtual XmlReader GetReader ()
|
||||
{
|
||||
@@ -143,14 +139,13 @@ namespace System.ServiceModel.Syndication
|
||||
|
||||
class DataContractReadWriteHandler : ReadWriteHandler
|
||||
{
|
||||
string name, ns;
|
||||
object extension;
|
||||
XmlObjectSerializer serializer;
|
||||
|
||||
public DataContractReadWriteHandler (string name, string ns, object extension, XmlObjectSerializer serializer)
|
||||
{
|
||||
this.name = name;
|
||||
this.ns = ns;
|
||||
this.Name = name;
|
||||
this.Namespace = ns;
|
||||
this.extension = extension;
|
||||
this.serializer = serializer;
|
||||
|
||||
@@ -158,18 +153,10 @@ namespace System.ServiceModel.Syndication
|
||||
this.serializer = new DataContractSerializer (extension.GetType ());
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
public override string Namespace {
|
||||
get { return ns; }
|
||||
}
|
||||
|
||||
public override void WriteTo (XmlWriter writer)
|
||||
{
|
||||
if (name != null) {
|
||||
writer.WriteStartElement (name, ns);
|
||||
if (Name != null) {
|
||||
writer.WriteStartElement (Name, Namespace);
|
||||
serializer.WriteObjectContent (writer, extension);
|
||||
writer.WriteFullEndElement ();
|
||||
}
|
||||
@@ -205,6 +192,8 @@ namespace System.ServiceModel.Syndication
|
||||
public XmlReaderReadWriteHandler (XmlReader reader)
|
||||
{
|
||||
reader.MoveToContent ();
|
||||
Name = reader.LocalName;
|
||||
Namespace = reader.NamespaceURI;
|
||||
xml = reader.ReadOuterXml ();
|
||||
}
|
||||
|
||||
|
||||
+11
-4
@@ -37,12 +37,18 @@ namespace System.ServiceModel.Syndication
|
||||
{
|
||||
public static class SyndicationVersions
|
||||
{
|
||||
private enum ReaderKind
|
||||
{
|
||||
Item,
|
||||
Feed,
|
||||
}
|
||||
|
||||
public const string Atom10 = "Atom10";
|
||||
public const string Rss20 = "Rss20";
|
||||
|
||||
const string AtomNamespace ="http://www.w3.org/2005/Atom";
|
||||
|
||||
static string DetectVersion (XmlReader reader)
|
||||
static string DetectVersion (XmlReader reader, ReaderKind kind)
|
||||
{
|
||||
if (reader == null)
|
||||
throw new ArgumentNullException ("reader");
|
||||
@@ -51,7 +57,8 @@ namespace System.ServiceModel.Syndication
|
||||
throw new XmlException ("An element is expected for syndication item");
|
||||
if (reader.IsStartElement ("rss", String.Empty) && reader.GetAttribute ("version") == "2.0")
|
||||
return SyndicationVersions.Rss20;
|
||||
if (reader.IsStartElement ("entry", AtomNamespace))
|
||||
if ((kind == ReaderKind.Item && reader.IsStartElement ("entry", AtomNamespace)) ||
|
||||
(kind == ReaderKind.Feed && reader.IsStartElement("feed", AtomNamespace)))
|
||||
return SyndicationVersions.Atom10;
|
||||
else if (reader.IsStartElement ("item", String.Empty))
|
||||
return SyndicationVersions.Rss20;
|
||||
@@ -61,7 +68,7 @@ namespace System.ServiceModel.Syndication
|
||||
|
||||
internal static TSyndicationFeed LoadFeed<TSyndicationFeed> (XmlReader reader) where TSyndicationFeed : SyndicationFeed, new()
|
||||
{
|
||||
switch (DetectVersion (reader)) {
|
||||
switch (DetectVersion (reader, ReaderKind.Feed)) {
|
||||
case SyndicationVersions.Atom10:
|
||||
Atom10FeedFormatter af = new Atom10FeedFormatter<TSyndicationFeed> ();
|
||||
af.ReadFrom (reader);
|
||||
@@ -76,7 +83,7 @@ namespace System.ServiceModel.Syndication
|
||||
|
||||
internal static TSyndicationItem LoadItem<TSyndicationItem> (XmlReader reader) where TSyndicationItem : SyndicationItem, new()
|
||||
{
|
||||
switch (DetectVersion (reader)) {
|
||||
switch (DetectVersion (reader, ReaderKind.Item)) {
|
||||
case SyndicationVersions.Atom10:
|
||||
Atom10ItemFormatter af = new Atom10ItemFormatter<TSyndicationItem> ();
|
||||
af.ReadFrom (reader);
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
2009-10-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebInvokeAttribute.cs
|
||||
WebChannelFactory.cs
|
||||
WebGetAttribute.cs
|
||||
WebOperationContext.cs
|
||||
IncomingWebResponseContext.cs
|
||||
OutgoingWebRequestContext.cs :
|
||||
Add experimental monotouch build.
|
||||
|
||||
2009-10-09 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebServiceHost.cs : call base.OnOpening() here too.
|
||||
|
||||
2009-09-04 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* OutgoingWebResponseContext.cs : add missing methods.
|
||||
|
||||
+4
-4
@@ -46,17 +46,17 @@ namespace System.ServiceModel.Web
|
||||
|
||||
public long ContentLength {
|
||||
get {
|
||||
string s = hp.Headers.Get ("Content-Length");
|
||||
string s = hp.Headers ["Content-Length"];
|
||||
return s != null ? long.Parse (s, CultureInfo.InvariantCulture) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public string ContentType {
|
||||
get { return hp.Headers.Get ("Content-Type"); }
|
||||
get { return hp.Headers ["Content-Type"]; }
|
||||
}
|
||||
|
||||
public string ETag {
|
||||
get { return hp.Headers.Get ("ETag"); }
|
||||
get { return hp.Headers ["ETag"]; }
|
||||
}
|
||||
|
||||
public WebHeaderCollection Headers {
|
||||
@@ -64,7 +64,7 @@ namespace System.ServiceModel.Web
|
||||
}
|
||||
|
||||
public string Location {
|
||||
get { return hp.Headers.Get ("Location"); }
|
||||
get { return hp.Headers ["Location"]; }
|
||||
}
|
||||
|
||||
public HttpStatusCode StatusCode {
|
||||
|
||||
+2
-1
@@ -62,7 +62,8 @@ namespace System.ServiceModel.Web
|
||||
|
||||
internal void Apply (HttpRequestMessageProperty hp)
|
||||
{
|
||||
hp.Headers.Add (Headers);
|
||||
foreach (var key in Headers.AllKeys)
|
||||
hp.Headers [key] = Headers [key];
|
||||
if (Accept != null)
|
||||
hp.Headers ["Accept"] = Accept;
|
||||
if (ContentLength > 0)
|
||||
|
||||
@@ -39,12 +39,24 @@ namespace System.ServiceModel.Web
|
||||
{
|
||||
public class WebChannelFactory<TChannel> : ChannelFactory<TChannel>
|
||||
{
|
||||
#if !NET_2_1
|
||||
public WebChannelFactory ()
|
||||
: base ()
|
||||
{
|
||||
}
|
||||
|
||||
public WebChannelFactory (Type serviceType)
|
||||
public WebChannelFactory(Binding binding)
|
||||
: base(binding)
|
||||
{
|
||||
}
|
||||
|
||||
public WebChannelFactory(ServiceEndpoint endpoint)
|
||||
: base(endpoint)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public WebChannelFactory(Type serviceType)
|
||||
: base (serviceType)
|
||||
{
|
||||
}
|
||||
@@ -54,11 +66,6 @@ namespace System.ServiceModel.Web
|
||||
{
|
||||
}
|
||||
|
||||
public WebChannelFactory (Binding binding)
|
||||
: base (binding)
|
||||
{
|
||||
}
|
||||
|
||||
public WebChannelFactory (Uri remoteAddress)
|
||||
: this (String.Empty, remoteAddress)
|
||||
{
|
||||
@@ -75,15 +82,12 @@ namespace System.ServiceModel.Web
|
||||
{
|
||||
}
|
||||
|
||||
public WebChannelFactory (ServiceEndpoint endpoint)
|
||||
: base (endpoint)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnOpening ()
|
||||
{
|
||||
#if !NET_2_1
|
||||
if (Endpoint.Behaviors.Find<WebHttpBehavior> () == null)
|
||||
Endpoint.Behaviors.Add (new WebHttpBehavior ());
|
||||
#endif
|
||||
|
||||
if (Endpoint.Binding == null)
|
||||
Endpoint.Binding = new WebHttpBinding ();
|
||||
|
||||
@@ -34,7 +34,12 @@ using System.ServiceModel.Dispatcher;
|
||||
namespace System.ServiceModel.Web
|
||||
{
|
||||
[AttributeUsage (AttributeTargets.Method)]
|
||||
public sealed class WebGetAttribute : Attribute, IOperationBehavior
|
||||
public sealed class WebGetAttribute
|
||||
#if NET_2_1
|
||||
: Attribute
|
||||
#else
|
||||
: Attribute, IOperationBehavior
|
||||
#endif
|
||||
{
|
||||
WebAttributeInfo info = new WebAttributeInfo () { Method = "GET" };
|
||||
|
||||
@@ -74,6 +79,7 @@ namespace System.ServiceModel.Web
|
||||
set { info.UriTemplate = value; }
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
void IOperationBehavior.AddBindingParameters (OperationDescription operation, BindingParameterCollection parameters)
|
||||
{
|
||||
// "it is a passive operation behavior"
|
||||
@@ -93,5 +99,6 @@ namespace System.ServiceModel.Web
|
||||
{
|
||||
// "it is a passive operation behavior"
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,12 @@ using System.ServiceModel.Dispatcher;
|
||||
namespace System.ServiceModel.Web
|
||||
{
|
||||
[AttributeUsage (AttributeTargets.Method)]
|
||||
public sealed class WebInvokeAttribute : Attribute, IOperationBehavior
|
||||
public sealed class WebInvokeAttribute
|
||||
#if NET_2_1
|
||||
: Attribute
|
||||
#else
|
||||
: Attribute, IOperationBehavior
|
||||
#endif
|
||||
{
|
||||
WebAttributeInfo info = new WebAttributeInfo ();
|
||||
|
||||
@@ -79,6 +84,7 @@ namespace System.ServiceModel.Web
|
||||
set { info.UriTemplate = value; }
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
void IOperationBehavior.AddBindingParameters (OperationDescription operation, BindingParameterCollection parameters)
|
||||
{
|
||||
// "it is a passive operation behavior"
|
||||
@@ -98,5 +104,6 @@ namespace System.ServiceModel.Web
|
||||
{
|
||||
// "it is a passive operation behavior"
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -30,10 +30,19 @@ using System.ServiceModel;
|
||||
using System.ServiceModel.Channels;
|
||||
using System.ServiceModel.Description;
|
||||
|
||||
#if NET_2_1
|
||||
using IncomingWebRequestContext = System.Object;
|
||||
using OutgoingWebResponseContext = System.Object;
|
||||
#endif
|
||||
|
||||
namespace System.ServiceModel.Web
|
||||
{
|
||||
public class WebOperationContext : IExtension<OperationContext>
|
||||
public class WebOperationContext
|
||||
#if !NET_2_1
|
||||
: IExtension<OperationContext>
|
||||
#endif
|
||||
{
|
||||
#if !NET_2_1
|
||||
public static WebOperationContext Current {
|
||||
get {
|
||||
if (OperationContext.Current == null)
|
||||
@@ -46,6 +55,7 @@ namespace System.ServiceModel.Web
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
IncomingWebRequestContext incoming_request;
|
||||
IncomingWebResponseContext incoming_response;
|
||||
@@ -56,15 +66,20 @@ namespace System.ServiceModel.Web
|
||||
{
|
||||
if (operation == null)
|
||||
throw new ArgumentNullException ("operation");
|
||||
incoming_request = new IncomingWebRequestContext (operation);
|
||||
incoming_response = new IncomingWebResponseContext (operation);
|
||||
|
||||
outgoing_request = new OutgoingWebRequestContext ();
|
||||
incoming_response = new IncomingWebResponseContext (operation);
|
||||
#if !NET_2_1
|
||||
incoming_request = new IncomingWebRequestContext (operation);
|
||||
outgoing_response = new OutgoingWebResponseContext ();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
public IncomingWebRequestContext IncomingRequest {
|
||||
get { return incoming_request; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public IncomingWebResponseContext IncomingResponse {
|
||||
get { return incoming_response; }
|
||||
@@ -74,9 +89,11 @@ namespace System.ServiceModel.Web
|
||||
get { return outgoing_request; }
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
public OutgoingWebResponseContext OutgoingResponse {
|
||||
get { return outgoing_response; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public void Attach (OperationContext context)
|
||||
{
|
||||
|
||||
@@ -56,6 +56,8 @@ namespace System.ServiceModel.Web
|
||||
|
||||
protected override void OnOpening ()
|
||||
{
|
||||
base.OnOpening ();
|
||||
|
||||
foreach (Uri baseAddress in BaseAddresses) {
|
||||
bool found = false;
|
||||
foreach (ServiceEndpoint se in Description.Endpoints)
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
System.Runtime.Serialization.Json/DataContractJsonSerializerTest.cs
|
||||
System.Runtime.Serialization.Json/JsonReaderTest.cs
|
||||
System.Runtime.Serialization.Json/JsonWriterTest.cs
|
||||
System.ServiceModel.Activation/WebScriptServiceHostFactoryTest.cs
|
||||
System.ServiceModel.Channels/WebBodyFormatMessagePropertyTest.cs
|
||||
System.ServiceModel.Channels/WebMessageEncodingBindingElementTest.cs
|
||||
System.ServiceModel.Description/WebHttpBehaviorTest.cs
|
||||
System.ServiceModel.Description/WebScriptEnablingBehaviorTest.cs
|
||||
System.ServiceModel.Dispatcher/JsonQueryStringConverterTest.cs
|
||||
System.ServiceModel.Dispatcher/QueryStringConverterTest.cs
|
||||
System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2008-10-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* WebHttpSecurity.cs, WebHttpBinding.cs:
|
||||
add experimental monotouch build.
|
||||
|
||||
2008-04-13 Igor Zelmanovich <[email protected]>
|
||||
|
||||
* WebHttpBinding.cs:
|
||||
|
||||
@@ -32,7 +32,12 @@ using System.Xml;
|
||||
|
||||
namespace System.ServiceModel
|
||||
{
|
||||
public class WebHttpBinding : Binding, IBindingRuntimePreferences
|
||||
public class WebHttpBinding
|
||||
#if NET_2_1
|
||||
: Binding
|
||||
#else
|
||||
: Binding, IBindingRuntimePreferences
|
||||
#endif
|
||||
{
|
||||
public WebHttpBinding ()
|
||||
: this (WebHttpSecurityMode.None)
|
||||
@@ -62,6 +67,11 @@ namespace System.ServiceModel
|
||||
// This can be changed only using <synchronousReceive> configuration element.
|
||||
bool receive_synchronously;
|
||||
|
||||
public EnvelopeVersion EnvelopeVersion {
|
||||
get { return EnvelopeVersion.None; }
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
public bool AllowCookies {
|
||||
get { return t.AllowCookies; }
|
||||
set { t.AllowCookies = value; }
|
||||
@@ -72,10 +82,6 @@ namespace System.ServiceModel
|
||||
set { t.BypassProxyOnLocal = value; }
|
||||
}
|
||||
|
||||
public EnvelopeVersion EnvelopeVersion {
|
||||
get { return EnvelopeVersion.None; }
|
||||
}
|
||||
|
||||
public HostNameComparisonMode HostNameComparisonMode {
|
||||
get { return t.HostNameComparisonMode; }
|
||||
set { t.HostNameComparisonMode = value; }
|
||||
@@ -86,6 +92,22 @@ namespace System.ServiceModel
|
||||
set { t.MaxBufferPoolSize = value; }
|
||||
}
|
||||
|
||||
public TransferMode TransferMode {
|
||||
get { return t.TransferMode; }
|
||||
set { t.TransferMode = value; }
|
||||
}
|
||||
|
||||
public bool UseDefaultWebProxy {
|
||||
get { return t.UseDefaultWebProxy; }
|
||||
set { t.UseDefaultWebProxy = value; }
|
||||
}
|
||||
|
||||
public Uri ProxyAddress {
|
||||
get { return t.ProxyAddress; }
|
||||
set { t.ProxyAddress = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public int MaxBufferSize {
|
||||
get { return t.MaxBufferSize; }
|
||||
set { t.MaxBufferSize = value; }
|
||||
@@ -96,15 +118,12 @@ namespace System.ServiceModel
|
||||
set { t.MaxReceivedMessageSize = value; }
|
||||
}
|
||||
|
||||
public Uri ProxyAddress {
|
||||
get { return t.ProxyAddress; }
|
||||
set { t.ProxyAddress = value; }
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
public XmlDictionaryReaderQuotas ReaderQuotas {
|
||||
get { return quotas; }
|
||||
set { quotas = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public override string Scheme {
|
||||
get { return Security.Mode != WebHttpSecurityMode.None ? Uri.UriSchemeHttps : Uri.UriSchemeHttp; }
|
||||
@@ -114,16 +133,6 @@ namespace System.ServiceModel
|
||||
get { return security; }
|
||||
}
|
||||
|
||||
public TransferMode TransferMode {
|
||||
get { return t.TransferMode; }
|
||||
set { t.TransferMode = value; }
|
||||
}
|
||||
|
||||
public bool UseDefaultWebProxy {
|
||||
get { return t.UseDefaultWebProxy; }
|
||||
set { t.UseDefaultWebProxy = value; }
|
||||
}
|
||||
|
||||
public Encoding WriteEncoding {
|
||||
get { return write_encoding; }
|
||||
set {
|
||||
@@ -136,14 +145,18 @@ namespace System.ServiceModel
|
||||
public override BindingElementCollection CreateBindingElements ()
|
||||
{
|
||||
WebMessageEncodingBindingElement m = new WebMessageEncodingBindingElement (WriteEncoding);
|
||||
#if !NET_2_1
|
||||
if (ReaderQuotas != null)
|
||||
ReaderQuotas.CopyTo (m.ReaderQuotas);
|
||||
#endif
|
||||
|
||||
return new BindingElementCollection (new BindingElement [] { m, t.Clone () });
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
bool IBindingRuntimePreferences.ReceiveSynchronously {
|
||||
get { return receive_synchronously; }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -31,19 +31,21 @@ namespace System.ServiceModel
|
||||
{
|
||||
internal WebHttpSecurity ()
|
||||
{
|
||||
// there is no public constructor for transport ...
|
||||
#if !NET_2_1
|
||||
Transport = new BasicHttpBinding ().Security.Transport;
|
||||
#endif
|
||||
}
|
||||
|
||||
WebHttpSecurityMode mode;
|
||||
// there is no publicly exposed constructor for transport ...
|
||||
HttpTransportSecurity transport = new BasicHttpBinding ().Security.Transport;
|
||||
|
||||
public WebHttpSecurityMode Mode {
|
||||
get { return mode; }
|
||||
set { mode = value; }
|
||||
}
|
||||
|
||||
public HttpTransportSecurity Transport {
|
||||
get { return transport; }
|
||||
}
|
||||
#if !NET_2_1
|
||||
public HttpTransportSecurity Transport { get; private set; }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-10-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* UriTemplate.cs, UriTemplateMatchException.cs, UriTemplateMatch.cs:
|
||||
Add experimental monotouch build.
|
||||
|
||||
2009-09-22 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* UriTemplate.cs : Fix method signatures. Take care of dictionary
|
||||
|
||||
@@ -32,6 +32,10 @@ using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
#if NET_2_1
|
||||
using NameValueCollection = System.Object;
|
||||
#endif
|
||||
|
||||
namespace System
|
||||
{
|
||||
public class UriTemplate
|
||||
@@ -102,6 +106,7 @@ namespace System
|
||||
|
||||
// Bind
|
||||
|
||||
#if !NET_2_1
|
||||
public Uri BindByName (Uri baseAddress, NameValueCollection parameters)
|
||||
{
|
||||
return BindByName (baseAddress, parameters, false);
|
||||
@@ -111,6 +116,7 @@ namespace System
|
||||
{
|
||||
return BindByNameCommon (baseAddress, parameters, null, omitDefaults);
|
||||
}
|
||||
#endif
|
||||
|
||||
public Uri BindByName (Uri baseAddress, IDictionary<string,string> parameters)
|
||||
{
|
||||
@@ -144,7 +150,11 @@ namespace System
|
||||
int s = template.IndexOf ('{', src);
|
||||
int e = template.IndexOf ('}', s + 1);
|
||||
sb.Append (template.Substring (src, s - src));
|
||||
#if NET_2_1
|
||||
string value = null;
|
||||
#else
|
||||
string value = nvc != null ? nvc [name] : null;
|
||||
#endif
|
||||
if (dic != null)
|
||||
dic.TryGetValue (name, out value);
|
||||
if (value == null && (omitDefaults || !Defaults.TryGetValue (name, out value)))
|
||||
@@ -204,11 +214,11 @@ namespace System
|
||||
|
||||
var us = baseAddress.LocalPath;
|
||||
if (us [us.Length - 1] != '/')
|
||||
baseAddress = new Uri (baseAddress.GetLeftPart (UriPartial.Path) + '/' + baseAddress.Query, baseAddress.IsAbsoluteUri ? UriKind.Absolute : UriKind.RelativeOrAbsolute);
|
||||
baseAddress = new Uri (baseAddress.GetComponents (UriComponents.SchemeAndServer | UriComponents.Path, UriFormat.Unescaped) + '/' + baseAddress.Query, baseAddress.IsAbsoluteUri ? UriKind.Absolute : UriKind.RelativeOrAbsolute);
|
||||
if (IgnoreTrailingSlash) {
|
||||
us = candidate.LocalPath;
|
||||
if (us.Length > 0 && us [us.Length - 1] != '/')
|
||||
candidate = new Uri (candidate.GetLeftPart (UriPartial.Path) + '/' + candidate.Query, candidate.IsAbsoluteUri ? UriKind.Absolute : UriKind.RelativeOrAbsolute);
|
||||
candidate = new Uri(candidate.GetComponents (UriComponents.SchemeAndServer | UriComponents.Path, UriFormat.Unescaped) + '/' + candidate.Query, candidate.IsAbsoluteUri ? UriKind.Absolute : UriKind.RelativeOrAbsolute);
|
||||
}
|
||||
|
||||
if (Uri.Compare (baseAddress, candidate, UriComponents.StrongAuthority, UriFormat.SafeUnescaped, StringComparison.Ordinal) != 0)
|
||||
@@ -342,7 +352,7 @@ namespace System
|
||||
string pname = pair [0];
|
||||
string pvalue = pair [1];
|
||||
if (pvalue.Length >= 2 && pvalue [0] == '{' && pvalue [pvalue.Length - 1] == '}') {
|
||||
string ptemplate = pvalue.Substring (1, pvalue.Length - 2).ToUpperInvariant ();
|
||||
string ptemplate = pvalue.Substring (1, pvalue.Length - 2).ToUpper (CultureInfo.InvariantCulture);
|
||||
query_params.Add (pname, ptemplate);
|
||||
if (list == null)
|
||||
list = new List<string> ();
|
||||
|
||||
@@ -29,6 +29,10 @@ using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
#if NET_2_1
|
||||
using NameValueCollection = System.Collections.Generic.Dictionary<string,string>;
|
||||
#endif
|
||||
|
||||
namespace System
|
||||
{
|
||||
public class UriTemplateMatch
|
||||
|
||||
@@ -31,13 +31,17 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace System
|
||||
{
|
||||
#if !NET_2_1
|
||||
[Serializable]
|
||||
#endif
|
||||
public class UriTemplateMatchException : SystemException
|
||||
{
|
||||
public UriTemplateMatchException () : base () {}
|
||||
public UriTemplateMatchException (string msg) : base (msg) {}
|
||||
public UriTemplateMatchException (string msg, Exception inner) : base (msg, inner) {}
|
||||
#if !NET_2_1
|
||||
protected UriTemplateMatchException (SerializationInfo info, StreamingContext context) :
|
||||
base (info, context) {}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-10-08 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* DataContractJsonSerializerTest.cs : added test for
|
||||
alwaysEmitTypeInformation argument.
|
||||
|
||||
2009-09-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* DataContractJsonSerializerTest.cs : fix non-datacontract
|
||||
|
||||
+30
@@ -1225,6 +1225,36 @@ namespace MonoTests.System.Runtime.Serialization.Json
|
||||
Assert.IsTrue (s.IndexOf ("/Bar/:/bar/") > 0, "#2-2");
|
||||
Assert.IsFalse (s.IndexOf ("/Baz/:/baz/") > 0, "#2-3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AlwaysEmitTypeInformation ()
|
||||
{
|
||||
var ms = new MemoryStream ();
|
||||
var ds = new DataContractJsonSerializer (typeof (string), "root", null, 10, false, null, true);
|
||||
ds.WriteObject (ms, "foobar");
|
||||
var s = Encoding.UTF8.GetString (ms.ToArray ());
|
||||
Assert.AreEqual ("\"foobar\"", s, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AlwaysEmitTypeInformation2 ()
|
||||
{
|
||||
var ms = new MemoryStream ();
|
||||
var ds = new DataContractJsonSerializer (typeof (TestData), "root", null, 10, false, null, true);
|
||||
ds.WriteObject (ms, new TestData () { Foo = "foo"});
|
||||
var s = Encoding.UTF8.GetString (ms.ToArray ());
|
||||
Assert.AreEqual (@"{""__type"":""TestData:#MonoTests.System.Runtime.Serialization.Json"",""Bar"":null,""Foo"":""foo""}", s, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AlwaysEmitTypeInformation3 ()
|
||||
{
|
||||
var ms = new MemoryStream ();
|
||||
var ds = new DataContractJsonSerializer (typeof (TestData), "root", null, 10, false, null, false);
|
||||
ds.WriteObject (ms, new TestData () { Foo = "foo"});
|
||||
var s = Encoding.UTF8.GetString (ms.ToArray ());
|
||||
Assert.AreEqual (@"{""Bar"":null,""Foo"":""foo""}", s, "#1");
|
||||
}
|
||||
}
|
||||
|
||||
public class TestData
|
||||
|
||||
Loaded 100 of 229 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user