summaryrefslogtreecommitdiff
path: root/SpacesToDasBlog
diff options
context:
space:
mode:
authormo.khan <mo.khan@a0a4a051-f042-0410-9e78-9fae330bdb64>2008-01-05 04:48:03 +0000
committermo.khan <mo.khan@a0a4a051-f042-0410-9e78-9fae330bdb64>2008-01-05 04:48:03 +0000
commit3d883a8c6f2da44ace5a389d556e71074cb1ed83 (patch)
tree381996a3280fac427d4c138a3a355632a0875ce9 /SpacesToDasBlog
parentac9c9184216e6cb066f8e68da5adc59929e1e015 (diff)
git-svn-id: http://mokhan.googlecode.com/svn/trunk@4 a0a4a051-f042-0410-9e78-9fae330bdb64
Diffstat (limited to 'SpacesToDasBlog')
-rw-r--r--SpacesToDasBlog/trunk/SpacesToDasBlog.sln20
-rw-r--r--SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Runtime.Proxies.dllbin0 -> 32768 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Runtime.dllbin0 -> 237568 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Util.dllbin0 -> 135168 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0.zipbin0 -> 328776 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/README.txt27
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/BettyApp.exebin0 -> 20480 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/BettyAsyncApp.exebin0 -> 20480 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/CookComputing.XmlRpc.CF.dllbin0 -> 73728 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/CookComputing.XmlRpcV2.dllbin0 -> 110592 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/IStateName.dllbin0 -> 16384 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/LoggingExample.exebin0 -> 4608 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/MathApp.exebin0 -> 32768 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/MathService.dllbin0 -> 16384 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameClient.exebin0 -> 16384 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameServer.exebin0 -> 20480 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameServer.exe.config17
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/xrpgen.exebin0 -> 28672 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin1_0/CookComputing.XmlRpc.dllbin0 -> 114688 bytes
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/BloggerAPI.cs149
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MeerkatAPI.cs73
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MetaWeblogAPI.cs141
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MovableTypeAPI.cs102
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/AssemblyInfo.cs58
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/StateNameService.cs129
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/XmlRpcStructTest.cs64
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/deserializerequesttest.cs1098
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/deserializeresponsetest.cs1333
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/invoketest.cs206
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/iso-8859-1_request.xml9
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/iso-8859-1_response.xml8
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/ntest.csproj155
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/optionaldeserializetest.cs467
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/optionalserializetest.cs444
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/paramstest.cs511
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/parsetest.cs720
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/proxygentest.cs277
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/remotingservertest.cs20
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serializeresponsetest.cs65
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serializetest.cs655
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serviceinfotest.cs313
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/utils.cs262
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyBuildNumber.cs18
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyDesc.cs31
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyDescFX1_0.cs31
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyInfo.cs47
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/CookComputing.XmlRpc.Targets71
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/GuidEx.cs222
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpRequest.cs38
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpRequestHandler.cs36
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpResponse.cs40
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IXmlRpcProxy.cs100
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/RequestResponseLogger.cs59
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/Tracer.cs57
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcAsyncResult.cs245
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcBeginAttribute.cs73
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcBoolean.cs89
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientFormatterSink.cs198
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientFormatterSinkProvider.cs76
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientProtocol.cs956
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientProtocol.resx0
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDateTime.cs92
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDocWriter.cs474
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDouble.cs91
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcEndAttribute.cs66
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcException.cs217
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcFaultException.cs86
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpRequest.cs44
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpResponse.cs61
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpServerProtocol.cs100
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcInt.cs90
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcLogger.cs66
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMemberAttribute.cs65
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMethodAttribute.cs65
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMethodInfo.cs107
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMissingMappingAttribute.cs63
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcNonStandard.cs43
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcParameterAttribute.cs62
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcParameterInfo.cs84
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcProxyCodeGen.cs953
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcProxyGen.cs566
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcRequest.cs69
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcRequestEventArgs.cs59
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcResponse.cs41
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcResponseEventArgs.cs61
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcReturnValueAttribute.cs48
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcSerializer.cs1825
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerFormatterSink.cs199
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerFormatterSinkProvider.cs81
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerProtocol.cs181
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcService.cs66
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServiceAttribute.cs79
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServiceInfo.cs416
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcStruct.cs97
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcUrlAttribute.cs49
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/util.cs99
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/xmlrpc.csproj248
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/xmlrpc.sln28
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xml-rpc.net.proj180
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xmlrpcCF/xmlrpcCF.csproj246
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/AssemblyInfo.vb34
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/Main.vb88
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/XrpGen.vb444
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/xrpgen.sln19
-rw-r--r--SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/xrpgen.vbproj118
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/App.config11
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Category.cs13
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/DasBlogWriter.cs55
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/ISpacesEntry.cs16
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/MsnSpacesMetaWeblog.cs146
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Post.cs17
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Program.cs33
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Properties/AssemblyInfo.cs33
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpaceHtmlParser.cs73
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpaceSettings.cs55
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpacesEntry.cs44
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpacesToDasBlog.ConsoleUI.csproj71
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/UserBlog.cs13
-rw-r--r--SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/UserInfo.cs17
119 files changed, 18477 insertions, 0 deletions
diff --git a/SpacesToDasBlog/trunk/SpacesToDasBlog.sln b/SpacesToDasBlog/trunk/SpacesToDasBlog.sln
new file mode 100644
index 0000000..1153439
--- /dev/null
+++ b/SpacesToDasBlog/trunk/SpacesToDasBlog.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpacesToDasBlog.ConsoleUI", "src\app\SpacesToDasBlog.Console\SpacesToDasBlog.ConsoleUI.csproj", "{CA56AAAF-6ED2-4CEC-B92E-9E1D7DD83B90}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CA56AAAF-6ED2-4CEC-B92E-9E1D7DD83B90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CA56AAAF-6ED2-4CEC-B92E-9E1D7DD83B90}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CA56AAAF-6ED2-4CEC-B92E-9E1D7DD83B90}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CA56AAAF-6ED2-4CEC-B92E-9E1D7DD83B90}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Runtime.Proxies.dll b/SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Runtime.Proxies.dll
new file mode 100644
index 0000000..9bbe733
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Runtime.Proxies.dll
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Runtime.dll b/SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Runtime.dll
new file mode 100644
index 0000000..1d044ca
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Runtime.dll
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Util.dll b/SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Util.dll
new file mode 100644
index 0000000..d5f3e7c
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/newtelligence.DasBlog.Util.dll
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0.zip b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0.zip
new file mode 100644
index 0000000..861b9d4
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0.zip
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/README.txt b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/README.txt
new file mode 100644
index 0000000..d135523
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/README.txt
@@ -0,0 +1,27 @@
+XML-RPC.NET - XML-RPC for .NET
+v2.1.0
+Copyright (C) 2001-2006 Charles Cook (chascook@gmail.com)
+
+xmlrpcgen
+Copyright (C) 2003 Joe Bork
+
+For more information about XML-RPC.NET visit http://www.xml-rpc.net.
+
+XML-RPC.NET is licensed with MIT X11 license.
+(see http://www.xml-rpc.net/faq/xmlrpcnetfaq.html#6.12)
+
+For more information about XML-RPC refer to http://www.xmlrpc.com/
+
+
+PREQUISITES
+-----------
+Assembly CookComputing.XmlRpc.dll requires 1.0 .NET runtime and
+runs on all later versions.
+
+Assembly CookComputing.XmlRpcV2.dll requires 2.0 .NET runtime.
+
+
+DOCUMENTATION
+-------------
+For help on using XML-RPC.NET, see
+http://www.xml-rpc.net/faq/xmlrpcnetfaq.html. \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/BettyApp.exe b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/BettyApp.exe
new file mode 100644
index 0000000..7ec0ca1
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/BettyApp.exe
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/BettyAsyncApp.exe b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/BettyAsyncApp.exe
new file mode 100644
index 0000000..0c798b6
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/BettyAsyncApp.exe
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/CookComputing.XmlRpc.CF.dll b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/CookComputing.XmlRpc.CF.dll
new file mode 100644
index 0000000..52f6c6d
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/CookComputing.XmlRpc.CF.dll
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/CookComputing.XmlRpcV2.dll b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/CookComputing.XmlRpcV2.dll
new file mode 100644
index 0000000..b4e8788
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/CookComputing.XmlRpcV2.dll
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/IStateName.dll b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/IStateName.dll
new file mode 100644
index 0000000..40946b3
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/IStateName.dll
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/LoggingExample.exe b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/LoggingExample.exe
new file mode 100644
index 0000000..8a30aed
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/LoggingExample.exe
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/MathApp.exe b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/MathApp.exe
new file mode 100644
index 0000000..a2083e4
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/MathApp.exe
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/MathService.dll b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/MathService.dll
new file mode 100644
index 0000000..4707df8
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/MathService.dll
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameClient.exe b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameClient.exe
new file mode 100644
index 0000000..2f4310a
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameClient.exe
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameServer.exe b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameServer.exe
new file mode 100644
index 0000000..72d2373
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameServer.exe
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameServer.exe.config b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameServer.exe.config
new file mode 100644
index 0000000..8b711fe
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/StateNameServer.exe.config
@@ -0,0 +1,17 @@
+<configuration>
+ <system.runtime.remoting>
+ <application>
+ <service>
+ <wellknown mode="Singleton" type="StateNameServer, StateNameServer" objectUri="statename.rem" />
+ </service>
+ <channels>
+ <channel ref="http" port="5678">
+ <serverProviders>
+ <formatter type="CookComputing.XmlRpc.XmlRpcServerFormatterSinkProvider, CookComputing.XmlRpcV2" />
+ <formatter ref="soap" />
+ </serverProviders>
+ </channel>
+ </channels>
+ </application>
+ </system.runtime.remoting>
+</configuration> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/xrpgen.exe b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/xrpgen.exe
new file mode 100644
index 0000000..f5fd5fb
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin/xrpgen.exe
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin1_0/CookComputing.XmlRpc.dll b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin1_0/CookComputing.XmlRpc.dll
new file mode 100644
index 0000000..2411f84
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/bin1_0/CookComputing.XmlRpc.dll
Binary files differ
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/BloggerAPI.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/BloggerAPI.cs
new file mode 100644
index 0000000..28994aa
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/BloggerAPI.cs
@@ -0,0 +1,149 @@
+
+using CookComputing.XmlRpc;
+
+namespace CookComputing.Blogger
+{
+ public struct Category
+ {
+ public string categoryid;
+ public string title;
+ public string description;
+ public string htmlUrl;
+ public string rssUrl;
+ }
+
+ public struct Post
+ {
+ public System.DateTime dateCreated;
+ [XmlRpcMember(
+ Description="Depending on server may be either string or integer. "
+ + "Use Convert.ToInt32(userid) to treat as integer or "
+ + "Convert.ToString(userid) to treat as string")]
+
+ //Livejournal sometimes drops these
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public object userid;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public string postid;
+ public string content;
+ }
+
+ public struct UserInfo
+ {
+ public string url;
+ public string email;
+ public string nickname;
+ public string lastname;
+ public string firstname;
+ }
+
+ public struct BlogInfo
+ {
+ public string blogid;
+ public string url;
+ public string blogName;
+ }
+
+ public interface IBlogger
+ {
+ [XmlRpcMethod("blogger.deletePost",
+ Description="Deletes a post.")]
+ [return: XmlRpcReturnValue(Description="Always returns true.")]
+ bool deletePost(
+ string appKey,
+ string postid,
+ string username,
+ string password,
+ [XmlRpcParameter(
+ Description="Where applicable, this specifies whether the blog "
+ + "should be republished after the post has been deleted.")]
+ bool publish);
+
+ [XmlRpcMethod("blogger.editPost",
+ Description="Edits a given post. Optionally, will publish the "
+ + "blog after making the edit.")]
+ [return: XmlRpcReturnValue(Description="Always returns true.")]
+ object editPost(
+ string appKey,
+ string postid,
+ string username,
+ string password,
+ string content,
+ bool publish);
+
+ [XmlRpcMethod("blogger.getCategories",
+ Description="Returns a list of the categories that you can use "
+ + "to log against a post.")]
+ Category[] getCategories(
+ string blogid,
+ string username,
+ string password);
+
+ [XmlRpcMethod("blogger.getPost",
+ Description="Returns a single post.")]
+ Post getPost(
+ string appKey,
+ string postid,
+ string username,
+ string password);
+
+ [XmlRpcMethod("blogger.getRecentPosts",
+ Description="Returns a list of the most recent posts in the system.")]
+ Post[] getRecentPosts(
+ string appKey,
+ string blogid,
+ string username,
+ string password,
+ int numberOfPosts);
+
+ [XmlRpcMethod("blogger.getTemplate",
+ Description="Returns the main or archive index template of "
+ + "a given blog.")]
+ string getTemplate(
+ string appKey,
+ string blogid,
+ string username,
+ string password,
+ string templateType);
+
+ [XmlRpcMethod("blogger.getUserInfo",
+ Description="Authenticates a user and returns basic user info "
+ + "(name, email, userid, etc.).")]
+ UserInfo getUserInfo(
+ string appKey,
+ string username,
+ string password);
+
+ [XmlRpcMethod("blogger.getUsersBlogs",
+ Description="Returns information on all the blogs a given user "
+ + "is a member.")]
+ BlogInfo[] getUsersBlogs(
+ string appKey,
+ string username,
+ string password);
+
+ [XmlRpcMethod("blogger.newPost",
+ Description="Makes a new post to a designated blog. Optionally, "
+ + "will publish the blog after making the post.")]
+ [return: XmlRpcReturnValue(Description="Id of new post")]
+ string newPost(
+ string appKey,
+ string blogid,
+ string username,
+ string password,
+ string content,
+ bool publish);
+
+ [XmlRpcMethod("blogger.setTemplate",
+ Description="Edits the main or archive index template of a given blog.")]
+ bool setTemplate(
+ string appKey,
+ string blogid,
+ string username,
+ string password,
+ string template,
+ string templateType);
+ }
+}
+
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MeerkatAPI.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MeerkatAPI.cs
new file mode 100644
index 0000000..448d61f
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MeerkatAPI.cs
@@ -0,0 +1,73 @@
+
+using CookComputing.XmlRpc;
+
+namespace CookComputing.Meerkat
+{
+
+ public struct Category
+ {
+ public int id;
+ public string title;
+ }
+
+ public struct Channel
+ {
+ public int id;
+ public string title;
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public struct Recipe
+ {
+ // search criteria
+ public XmlRpcInt channel;
+ public XmlRpcInt category;
+ public XmlRpcInt item;
+ public string search;
+ public string search_what;
+ public string time_period;
+ public XmlRpcInt profile;
+ public XmlRpcInt mob;
+ public string url;
+ // display recipes
+ public int ids;
+ public int descriptions;
+ public int categories;
+ public int channels;
+ public int dates;
+ public int dc;
+ public XmlRpcInt num_items;
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public struct Result
+ {
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public string title;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public string link;
+ public string description;
+ public string dc_creator;
+ public string dc_subject;
+ public string dc_publisher;
+ public string dc_date;
+ public string dc_format;
+ public string dc_language;
+ public string dc_rights;
+ }
+
+ [XmlRpcUrl("http://www.oreillynet.com/meerkat/xml-rpc/server.php")]
+ public interface IMeerkat
+ {
+ [XmlRpcMethod("meerkat.getCategories")]
+ Category[] GetCategories();
+ [XmlRpcMethod("meerkat.getChannels")]
+ Channel[] GetChannels();
+ [XmlRpcMethod("meerkat.getChannelsByCategory")]
+ Channel[] GetChannelsByCategory(int id);
+ [XmlRpcMethod("meerkat.getItems")]
+ Result[] GetItems(Recipe recipe);
+ }
+
+}
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MetaWeblogAPI.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MetaWeblogAPI.cs
new file mode 100644
index 0000000..8a094ad
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MetaWeblogAPI.cs
@@ -0,0 +1,141 @@
+
+using System;
+using CookComputing.XmlRpc;
+
+namespace CookComputing.MetaWeblog
+{
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public struct Enclosure
+ {
+ public int length;
+ public string type;
+ public string url;
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public struct Source
+ {
+ public string name;
+ public string url;
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public struct Post
+ {
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ [XmlRpcMember(Description="Required when posting.")]
+ public DateTime dateCreated;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ [XmlRpcMember(Description="Required when posting.")]
+ public string description;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ [XmlRpcMember(Description="Required when posting.")]
+ public string title;
+
+ public string[] categories;
+ public Enclosure enclosure;
+ public string link;
+ public string permalink;
+ [XmlRpcMember(
+ Description="Not required when posting. Depending on server may "
+ + "be either string or integer. "
+ + "Use Convert.ToInt32(postid) to treat as integer or "
+ + "Convert.ToString(postid) to treat as string")]
+ public object postid;
+ public Source source;
+ public string userid;
+
+ public object mt_allow_comments;
+ public object mt_allow_pings;
+ public object mt_convert_breaks;
+ public string mt_text_more;
+ public string mt_excerpt;
+ }
+
+ public struct CategoryInfo
+ {
+ public string description;
+ public string htmlUrl;
+ public string rssUrl;
+ public string title;
+ public string categoryid;
+ }
+
+ public struct Category
+ {
+ public string categoryId;
+ public string categoryName;
+ }
+
+ public struct FileData
+ {
+ public byte[] bits;
+ public string name;
+ public string type;
+ }
+
+ public struct UrlData
+ {
+ public string url;
+ }
+
+ public interface IMetaWeblog
+ {
+ [XmlRpcMethod("metaWeblog.editPost",
+ Description="Updates and existing post to a designated blog "
+ + "using the metaWeblog API. Returns true if completed.")]
+ object editPost(
+ string postid,
+ string username,
+ string password,
+ Post post,
+ bool publish);
+
+ [XmlRpcMethod("metaWeblog.getCategories",
+ Description="Retrieves a list of valid categories for a post "
+ + "using the metaWeblog API. Returns the metaWeblog categories "
+ + "struct collection.")]
+ CategoryInfo[] getCategories(
+ string blogid,
+ string username,
+ string password);
+
+ [XmlRpcMethod("metaWeblog.getPost",
+ Description="Retrieves an existing post using the metaWeblog "
+ + "API. Returns the metaWeblog struct.")]
+ Post getPost(
+ string postid,
+ string username,
+ string password);
+
+ [XmlRpcMethod("metaWeblog.getRecentPosts",
+ Description="Retrieves a list of the most recent existing post "
+ + "using the metaWeblog API. Returns the metaWeblog struct collection.")]
+ Post[] getRecentPosts(
+ string blogid,
+ string username,
+ string password,
+ int numberOfPosts);
+
+ [XmlRpcMethod("metaWeblog.newPost",
+ Description="Makes a new post to a designated blog using the "
+ + "metaWeblog API. Returns postid as a string.")]
+ string newPost(
+ string blogid,
+ string username,
+ string password,
+ Post post,
+ bool publish);
+
+ [XmlRpcMethod("metaWeblog.newMediaObject",
+ Description = "Makes a new file to a designated blog using the "
+ + "metaWeblog API. Returns url as a string of a struct.")]
+ UrlData newMediaObject(
+ string blogid,
+ string username,
+ string password,
+ FileData file);
+ }
+}
+
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MovableTypeAPI.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MovableTypeAPI.cs
new file mode 100644
index 0000000..291ced1
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/interfaces/MovableTypeAPI.cs
@@ -0,0 +1,102 @@
+
+using System;
+using CookComputing.XmlRpc;
+
+namespace CookComputing.MovableType
+{
+ public struct Category
+ {
+ public string categoryId;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public string categoryName;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public bool isPrimary;
+ }
+
+ public struct PostTitle
+ {
+ [XmlRpcMember(Description="This is in the timezone of the weblog blogid.")]
+ public DateTime created;
+ public string postid;
+ public string userid;
+ public string title;
+ }
+
+ public struct TrackbackPing
+ {
+ [XmlRpcMember(Description="The title of the entry sent in the ping.")]
+ public string pingTitle;
+ [XmlRpcMember(Description="The URL of the entry.")]
+ public string pingURL;
+ [XmlRpcMember(Description="The IP address of the host that sent the ping.")]
+ public string pingIP;
+ }
+
+ public interface IMovableType
+ {
+ [XmlRpcMethod("mt.getCategoryList",
+ Description="Returns a list of all categories defined in the weblog.")]
+ [return: XmlRpcReturnValue(
+ Description="The isPrimary member of each Category structs is not used.")]
+ Category[] getCategoryList(
+ string blogid,
+ string username,
+ string password);
+
+ [XmlRpcMethod("mt.getPostCategories",
+ Description="Returns a list of all categories to which the post is "
+ + "assigned.")]
+ Category[] getPostCategories(
+ string postid,
+ string username,
+ string password);
+
+ [XmlRpcMethod("mt.getRecentPostTitles",
+ Description="Returns a bandwidth-friendly list of the most recent "
+ + "posts in the system.")]
+ PostTitle[] getRecentPostTitles(
+ string blogid,
+ string username,
+ string password,
+ int numberOfPosts);
+
+ [XmlRpcMethod("mt.getTrackbackPings",
+ Description="Retrieve the list of TrackBack pings posted to a "
+ + "particular entry. This could be used to programmatically "
+ + "retrieve the list of pings for a particular entry, then "
+ + "iterate through each of those pings doing the same, until "
+ + "one has built up a graph of the web of entries referencing "
+ + "one another on a particular topic.")]
+ TrackbackPing[] getTrackbackPings(
+ string postid);
+
+ [XmlRpcMethod("mt.publishPost",
+ Description="Publish (rebuild) all of the static files related "
+ + "to an entry from your weblog. Equivalent to saving an entry "
+ + "in the system (but without the ping).")]
+ [return: XmlRpcReturnValue(Description="Always returns true.")]
+ bool publishPost(
+ string postid,
+ string username,
+ string password);
+
+ [XmlRpcMethod("mt.setPostCategories",
+ Description="Sets the categories for a post.")]
+ [return: XmlRpcReturnValue(Description="Always returns true.")]
+ bool setPostCategories(
+ string postid,
+ string username,
+ string password,
+ [XmlRpcParameter(
+ Description="categoryName not required in Category struct.")]
+ Category[] categories);
+
+ [XmlRpcMethod("mt.supportedMethods",
+ Description="The method names supported by the server.")]
+ [return: XmlRpcReturnValue(
+ Description="The method names supported by the server.")]
+ string[] supportedMethods();
+ }
+}
+
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/AssemblyInfo.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/AssemblyInfo.cs
new file mode 100644
index 0000000..177a4f0
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/StateNameService.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/StateNameService.cs
new file mode 100644
index 0000000..4b7f45d
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/StateNameService.cs
@@ -0,0 +1,129 @@
+using System;
+using System.Collections;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Http;
+using System.Text;
+using System.Threading;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+
+ class StateNameService
+ {
+ static HttpChannel _channel;
+
+ public static void Start(int port)
+ {
+ try
+ {
+ IDictionary props = new Hashtable();
+ props["name"] = "MyHttpChannel";
+ props["port"] = port;
+ _channel = new HttpChannel(
+ props,
+ null,
+ new XmlRpcServerFormatterSinkProvider()
+ );
+ ChannelServices.RegisterChannel(_channel, false);
+ RemotingConfiguration.RegisterWellKnownServiceType(
+ typeof(StateNameServer),
+ "statename.rem",
+ WellKnownObjectMode.Singleton);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex);
+ throw;
+ }
+ }
+
+ public static void Stop()
+ {
+ ChannelServices.UnregisterChannel(_channel);
+ Thread.Sleep(100);
+ }
+ }
+}
+
+
+public struct StateStructRequest
+{
+ public int state1;
+ public int state2;
+ public int state3;
+}
+
+[XmlRpcUrl("http://localhost:5678/statename.rem")]
+public interface IStateName :IXmlRpcProxy
+{
+ [XmlRpcMethod("examples.getStateName")]
+ string GetStateName(int stateNumber);
+
+ [XmlRpcMethod("examples.getStateNameFromString")]
+ string GetStateName(string stateNumber);
+
+ [XmlRpcBegin("examples.getStateName")]
+ IAsyncResult BeginGetStateName(int stateNumber);
+
+ [XmlRpcBegin("examples.getStateName")]
+ IAsyncResult BeginGetStateName(int stateNumber, AsyncCallback callback);
+
+ [XmlRpcBegin("examples.getStateName")]
+ IAsyncResult BeginGetStateName(int stateNumber, AsyncCallback callback,
+ object asyncState);
+
+ [XmlRpcEnd]
+ string EndGetStateName(IAsyncResult iasr);
+
+ [XmlRpcMethod("examples.getStateStruct")]
+ string GetStateNames(StateStructRequest request);
+}
+
+public class StateNameServer : MarshalByRefObject
+{
+ [XmlRpcMethod("examples.getStateName")]
+ public string GetStateName(int stateNumber)
+ {
+ if (stateNumber < 1 || stateNumber > m_stateNames.Length)
+ throw new XmlRpcFaultException(1, "Invalid state number");
+ return m_stateNames[stateNumber - 1];
+ }
+
+ [XmlRpcMethod("examples.getStateNameFromString")]
+ public string GetStateNameFromString(string stateNumber)
+ {
+ int number = Convert.ToInt32(stateNumber);
+ if (number < 1 || number > m_stateNames.Length)
+ throw new XmlRpcFaultException(1, "Invalid state number");
+ return m_stateNames[number - 1];
+ }
+
+ [XmlRpcMethod("examples.getStateStruct")]
+ public string GetStateNames(StateStructRequest request)
+ {
+ if (request.state1 < 1 || request.state1 > m_stateNames.Length)
+ throw new XmlRpcFaultException(1, "State number 1 invalid");
+ if (request.state2 < 1 || request.state2 > m_stateNames.Length)
+ throw new XmlRpcFaultException(1, "State number 1 invalid");
+ if (request.state3 < 1 || request.state3 > m_stateNames.Length)
+ throw new XmlRpcFaultException(1, "State number 1 invalid");
+ string ret = m_stateNames[request.state1 - 1] + " "
+ + m_stateNames[request.state2 - 1] + " "
+ + m_stateNames[request.state3 - 1];
+ return ret;
+ }
+
+ string[] m_stateNames
+ = { "Alabama", "Alaska", "Arizona", "Arkansas",
+ "California", "Colorado", "Connecticut", "Delaware", "Florida",
+ "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa",
+ "Kansas", "Kentucky", "Lousiana", "Maine", "Maryland", "Massachusetts",
+ "Michigan", "Minnesota", "Mississipi", "Missouri", "Montana",
+ "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico",
+ "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma",
+ "Oregon", "Pennsylviania", "Rhose Island", "South Carolina",
+ "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia",
+ "Washington", "West Virginia", "Wisconsin", "Wyoming" };
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/XmlRpcStructTest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/XmlRpcStructTest.cs
new file mode 100644
index 0000000..e155e9f
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/XmlRpcStructTest.cs
@@ -0,0 +1,64 @@
+using System;
+using System.IO;
+using System.Reflection;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+ [TestFixture]
+ public class XmlRpcStructTest
+ {
+ [Test]
+ public void Set()
+ {
+ XmlRpcStruct xps = new XmlRpcStruct();
+ xps["foo"] = "abcdef";
+ Assert.AreEqual("abcdef", xps["foo"]);
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void SetInvalidKey()
+ {
+ XmlRpcStruct xps = new XmlRpcStruct();
+ xps[1] = "abcdef";
+ }
+
+ [Test]
+ public void DoubleSet()
+ {
+ XmlRpcStruct xps = new XmlRpcStruct();
+ xps["foo"] = "12345";
+ xps["foo"] = "abcdef";
+ Assert.AreEqual("abcdef", xps["foo"]);
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void AddInvalidKey()
+ {
+ XmlRpcStruct xps = new XmlRpcStruct();
+ xps.Add(1, "abcdef");
+ }
+
+ [Test]
+ public void Add()
+ {
+ XmlRpcStruct xps = new XmlRpcStruct();
+ xps.Add("foo", "abcdef");
+ Assert.AreEqual("abcdef", xps["foo"]);
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void DoubleAdd()
+ {
+ XmlRpcStruct xps = new XmlRpcStruct();
+ xps.Add("foo", "123456");
+ xps.Add("foo", "abcdef");
+ Assert.Fail("Test should throw ArgumentException");
+ }
+
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/deserializerequesttest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/deserializerequesttest.cs
new file mode 100644
index 0000000..7fe8555
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/deserializerequesttest.cs
@@ -0,0 +1,1098 @@
+using System;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Threading;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+ [TestFixture]
+ public class DeserializeRequestTest
+ {
+ [Test]
+ public void StringElement()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestString</methodName>
+ <params>
+ <param>
+ <value><string>test string</string></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.AreEqual(request.method, "TestString", "method is TestString");
+ Assert.AreEqual(request.args[0].GetType(), typeof(string),
+ "argument is string");
+ Assert.AreEqual((string)request.args[0], "test string",
+ "argument is 'test string'");
+ }
+
+ [Test]
+ public void StringNoStringElement()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestString</methodName>
+ <params>
+ <param>
+ <value>test string</value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.AreEqual(request.method, "TestString", "method is TestString");
+ Assert.AreEqual(request.args[0].GetType(), typeof(string),
+ "argument is string");
+ Assert.AreEqual((string)request.args[0], "test string",
+ "argument is 'test string'");
+ }
+
+ [Test]
+ public void StringEmptyValue1()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestString</methodName>
+ <params>
+ <param>
+ <value></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.AreEqual(request.method, "TestString", "method is TestString");
+ Assert.AreEqual(request.args[0].GetType(), typeof(string),
+ "argument is string");
+ Assert.AreEqual((string)request.args[0], "", "argument is empty string");
+ }
+
+ [Test]
+ public void StringEmptyValue2()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestString</methodName>
+ <params>
+ <param>
+ <value/>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.AreEqual(request.method, "TestString", "method is TestString");
+ Assert.AreEqual(request.args[0].GetType(), typeof(string),
+ "argument is string");
+ Assert.AreEqual((string)request.args[0], "", "argument is empty string");
+ }
+
+ [Test]
+ public void FlatXml()
+ {
+ string xml = @"<?xml version=""1.0"" ?><methodCall><methodName>TestString</methodName><params><param><value>test string</value></param></params></methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.AreEqual(request.method, "TestString", "method is TestString");
+ Assert.AreEqual(request.args[0].GetType(), typeof(string),
+ "argument is string");
+ Assert.AreEqual((string)request.args[0], "test string",
+ "argument is 'test string'");
+ }
+
+ [Test]
+ public void NullRequestStream()
+ {
+ try
+ {
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ Stream stm = null;
+ XmlRpcRequest request = serializer.DeserializeRequest(stm, null);
+ Assert.Fail("Should throw ArgumentNullException");
+ }
+ catch (ArgumentNullException)
+ {
+ }
+ }
+
+ [Test]
+ public void EmptyRequestStream()
+ {
+ try
+ {
+ StringReader sr = new StringReader("");
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ Assert.Fail("Should throw XmlRpcIllFormedXmlException");
+ }
+ catch(XmlRpcIllFormedXmlException)
+ {
+ }
+ }
+
+ [Test]
+ public void InvalidXml()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall> </duffMmethodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ Assert.Fail("Should throw XmlRpcIllFormedXmlException");
+ }
+ catch(XmlRpcIllFormedXmlException)
+ {
+ }
+ }
+
+ // test handling of methodCall element
+ [Test]
+ public void MissingMethodCall()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?> <elem/>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ Assert.Fail("Should throw XmlRpcInvalidXmlRpcException");
+ }
+ catch(XmlRpcInvalidXmlRpcException)
+ {
+ }
+ }
+
+ // test handling of methodName element
+ [Test]
+ public void MissingMethodName()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <params>
+ <param>
+ <value>test string</value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+ // TODO: should return InvalidXmlRpc
+ string s = ex.Message;
+ }
+ }
+
+ [Test]
+ public void EmptyMethodName()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName/>
+ <params>
+ <param>
+ <value>test string</value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+
+ // TODO: should return InvalidXmlRpc
+ string s = ex.Message;
+ }
+ }
+
+ [Test]
+ public void ZeroLengthMethodName()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName></methodName>
+ <params>
+ <param>
+ <value>test string</value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+ // TODO: should return InvalidXmlRpc
+ string s = ex.Message;
+ }
+ }
+
+ [Test]
+ public void InvalidCharsMethodName()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName></methodName>
+ <params>
+ <param>
+ <value>test string</value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+ // TODO: should return InvalidXmlRpc
+ string s = ex.Message;
+ }
+ }
+
+ // test handling of params element
+ [Test]
+ public void MissingParams()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestString</methodName>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+ string s = ex.Message;
+ }
+ }
+
+
+ [XmlRpcMethod]
+ public string MethodNoArgs()
+ {
+ return "";
+ }
+
+ // test handling of params element
+ [Test]
+ public void NoParam1()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>MethodNoArgs</methodName>
+ <params/>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, this.GetType());
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine(ex);
+ }
+ }
+
+ // test handling of param element
+ [Test]
+ public void NoParam2()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>MethodNoArgs</methodName>
+ <params>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, this.GetType());
+ //Console.WriteLine("");
+ }
+
+ [Test]
+ public void EmptyParam1()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestString</methodName>
+ <params>
+ <param/>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+ string s = ex.Message;
+ }
+ }
+
+ [Test]
+ public void EmptyParam2()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestString</methodName>
+ <params>
+ <param>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+ string s = ex.Message;
+ }
+ }
+
+ // test handling integer values
+ [Test]
+ public void Integer()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestInt</methodName>
+ <params>
+ <param>
+ <value><int>666</int></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.IsTrue(request.method == "TestInt", "method is TestInt");
+ Assert.AreEqual(request.args[0].GetType(), typeof(int),
+ "argument is int");
+ Assert.AreEqual((int)request.args[0], 666, "argument is 666");
+ }
+
+ [Test]
+ public void I4Integer()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestInt</methodName>
+ <params>
+ <param>
+ <value><i4>666</i4></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.IsTrue(request.method == "TestInt", "method is TestInt");
+ Assert.AreEqual(request.args[0].GetType(), typeof(int),
+ "argument is int");
+ Assert.AreEqual((int)request.args[0], 666, "argument is 666");
+ }
+
+ [Test]
+ public void IntegerWithPlus()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestInt</methodName>
+ <params>
+ <param>
+ <value><i4>+666</i4></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.IsTrue(request.method == "TestInt", "method is TestInt");
+ Assert.AreEqual(request.args[0].GetType(), typeof(int),
+ "argument is int");
+ Assert.AreEqual((int)request.args[0], 666, "argument is 666");
+ }
+
+ [Test]
+ public void NegativeInteger()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestInt</methodName>
+ <params>
+ <param>
+ <value><i4>-666</i4></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.IsTrue(request.method == "TestInt", "method is TestInt");
+ Assert.AreEqual(request.args[0].GetType(), typeof(int),
+ "argument is int");
+ Assert.AreEqual((int)request.args[0], -666, "argument is -666");
+ }
+
+ [Test]
+ public void EmptyInteger()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestInt</methodName>
+ <params>
+ <param>
+ <value><i4></i4></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+ string s = ex.Message;
+ }
+ }
+
+ [Test]
+ public void InvalidInteger()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestInt</methodName>
+ <params>
+ <param>
+ <value><i4>12kiol</i4></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ Assert.Fail("Invalid integer should cause exception");
+ }
+ catch(Exception ex)
+ {
+ string s = ex.Message;
+ }
+ }
+
+ [Test]
+ public void OverflowInteger()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestInt</methodName>
+ <params>
+ <param>
+ <value><i4>99999999999999999999</i4></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+ string s = ex.Message;
+ }
+ }
+
+ [Test]
+ public void ZeroInteger()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestInt</methodName>
+ <params>
+ <param>
+ <value><i4>0</i4></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.IsTrue(request.method == "TestInt", "method is TestInt");
+ Assert.AreEqual(request.args[0].GetType(), typeof(int),
+ "argument is int");
+ Assert.AreEqual((int)request.args[0], 0, "argument is 0");
+ }
+
+ [Test]
+ public void NegativeOverflowInteger()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+ <methodName>TestInt</methodName>
+ <params>
+ <param>
+ <value><i4>-99999999999999999999</i4></value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ }
+ catch(Exception ex)
+ {
+ string s = ex.Message;
+ }
+ }
+
+ [Test]
+ public void ISO_8859_1()
+ {
+ using(Stream stm = new FileStream("../iso-8859-1_request.xml",
+ FileMode.Open, FileAccess.Read))
+ {
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(stm, null);
+ Assert.AreEqual(request.args[0].GetType(), typeof(string),
+ "argument is string");
+ Assert.AreEqual((string)request.args[0], "hæ hvað segirðu þá",
+ "argument is 'hæ hvað segirðu þá'");
+ }
+ }
+
+ struct Struct3
+ {
+ int _member1;
+ public int member1 { get { return _member1; } set { _member1 = value; } }
+
+ int _member2;
+ public int member2 { get { return _member2; } }
+
+ int _member3;
+ [XmlRpcMember("member-3")]
+ public int member3 { get { return _member3; } set { _member3 = value; } }
+
+ int _member4;
+ [XmlRpcMember("member-4")]
+ public int member4 { get { return _member4; } }
+ }
+
+ [Test]
+ public void StructProperties()
+ {
+ string xml = @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo</methodName>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>member1</name>
+ <value>
+ <i4>1</i4>
+ </value>
+ </member>
+ <member>
+ <name>member2</name>
+ <value>
+ <i4>2</i4>
+ </value>
+ </member>
+ <member>
+ <name>member-3</name>
+ <value>
+ <i4>3</i4>
+ </value>
+ </member>
+ <member>
+ <name>member-4</name>
+ <value>
+ <i4>4</i4>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.AreEqual(request.args[0].GetType(), typeof(XmlRpcStruct),
+ "argument is XmlRpcStruct");
+ XmlRpcStruct xrs = (XmlRpcStruct)request.args[0];
+ Assert.IsTrue(xrs.Count == 4, "XmlRpcStruct has 4 members");
+ Assert.IsTrue(xrs.ContainsKey("member1") && (int)xrs["member1"] == 1,
+ "member1");
+ Assert.IsTrue(xrs.ContainsKey("member2") && (int)xrs["member2"] == 2,
+ "member2");
+ Assert.IsTrue(xrs.ContainsKey("member-3") && (int)xrs["member-3"] == 3,
+ "member-3");
+ Assert.IsTrue(xrs.ContainsKey("member-4") && (int)xrs["member-4"] == 4,
+ "member-4");
+
+
+
+ }
+
+ // test handling dateTime values
+
+
+ [Test]
+ public void DateTimeFormats()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodCall>
+<methodName>TestDateTime</methodName>
+<params>
+ <param>
+ <value><dateTime.iso8601>20020707T11:25:37Z</dateTime.iso8601></value>
+ </param>
+ <param>
+ <value><dateTime.iso8601>20020707T11:25:37</dateTime.iso8601></value>
+ </param>
+ <param>
+ <value><dateTime.iso8601>2002-07-07T11:25:37Z</dateTime.iso8601></value>
+ </param>
+ <param>
+ <value><dateTime.iso8601>2002-07-07T11:25:37</dateTime.iso8601></value>
+ </param>
+</params>
+</methodCall>";
+
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.AllowNonStandardDateTime;
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.IsTrue(request.args[0] is DateTime, "argument is DateTime");
+ DateTime dt0 = (DateTime)request.args[0];
+ DateTime dt1 = (DateTime)request.args[1];
+ DateTime dt2 = (DateTime)request.args[2];
+ DateTime dt3 = (DateTime)request.args[3];
+
+ DateTime dt = new DateTime(2002, 7, 7, 11, 25, 37);
+ Assert.AreEqual(dt0, dt, "DateTime WordPress");
+ Assert.AreEqual(dt0, dt, "DateTime XML-RPC spec");
+ Assert.AreEqual(dt0, dt, "DateTime TypePad");
+ Assert.AreEqual(dt0, dt, "DateTime other");
+ }
+
+ [Test]
+ public void DateTimeLocales()
+ {
+ CultureInfo oldci = Thread.CurrentThread.CurrentCulture;
+ try
+ {
+ foreach (string locale in Utils.GetLocales())
+ {
+ try
+ {
+ CultureInfo ci = new CultureInfo(locale);
+ Thread.CurrentThread.CurrentCulture = ci;
+ if (ci.LCID == 0x401 // ar-SA (Arabic - Saudi Arabia)
+ || ci.LCID == 0x465 // div-MV (Dhivehi - Maldives)
+ || ci.LCID == 0x41e) // th-TH (Thai - Thailand)
+ break;
+
+ DateTime dt = new DateTime(1900, 01, 02, 03, 04, 05);
+ while (dt < DateTime.Now)
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { dt };
+ req.method = "Foo";
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(stm, null);
+
+ Assert.IsTrue(request.args[0] is DateTime,
+ "argument is DateTime");
+ DateTime dt0 = (DateTime)request.args[0];
+ Assert.AreEqual(dt0, dt, "DateTime argument 0");
+ dt += new TimeSpan(100, 1, 1, 1);
+ }
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(String.Format("unexpected exception {0}: {1}",
+ locale, ex.Message));
+ }
+ }
+ }
+ finally
+ {
+ Thread.CurrentThread.CurrentCulture = oldci;
+ }
+ }
+
+
+
+ // // test handling double values
+ //
+ //
+ // // test handling string values
+ //
+
+
+
+ //
+ // // test handling base64 values
+ [Test]
+ public void Base64Empty()
+ {
+ string xml = @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>TestHex</methodName>
+ <params>
+ <param>
+ <value>
+ <base64></base64>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.AreEqual(request.args[0].GetType(), typeof(byte[]),
+ "argument is byte[]");
+ Assert.AreEqual(request.args[0], new byte[0],
+ "argument is zero length byte[]");
+ }
+
+ [Test]
+ public void Base64()
+ {
+ string xml = @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>TestHex</methodName>
+ <params>
+ <param>
+ <value>
+ <base64>AQIDBAUGBwg=</base64>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.AreEqual(request.args[0].GetType(), typeof(byte[]),
+ "argument is byte[]");
+ byte[] ret = (byte[])request.args[0];
+ Assert.AreEqual(8, ret.Length, "argument is byte[8]");
+ for (int i = 0; i < ret.Length; i++)
+ Assert.AreEqual(i+1, ret[i], "members are 1 to 8");
+ }
+
+ [Test]
+ public void Base64MultiLine()
+ {
+ string xml = @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>TestHex</methodName>
+ <params>
+ <param>
+ <value>
+ <base64>AQIDBAUGBwgJ
+AQIDBAUGBwg=</base64>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+
+ Assert.AreEqual(request.args[0].GetType(), typeof(byte[]),
+ "argument is byte[]");
+ byte[] ret = (byte[])request.args[0];
+ Assert.AreEqual(17, ret.Length, "argument is byte[17]");
+ for (int i = 0; i < 9; i++)
+ Assert.AreEqual(i + 1, ret[i], "first 9 members are 1 to 9");
+ for (int i = 0; i < 8; i++)
+ Assert.AreEqual(i + 1, ret[i + 9], "last 8 members are 1 to 9");
+ }
+
+
+ // // test array handling
+ //
+ //
+ //
+ // // tests of handling of structs
+ // public void testMissingMemberStruct()
+ // {
+ // string xml = @"<?xml version=""1.0"" ?>
+ //<methodCall>
+ // <methodName>TestStruct</methodName>
+ // <params>
+ // <param>
+ // </param>
+ // </params>
+ //</methodCall>";
+ // StringReader sr = new StringReader(xml);
+ // XmlRpcSerializer serializer = new XmlRpcSerializer();
+ // XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ // }
+ //
+ // public void testAdditonalMemberStruct()
+ // {
+ // string xml = @"<?xml version=""1.0"" ?>
+ //<methodCall>
+ // <methodName>TestStruct</methodName>
+ // <params>
+ // <param>
+ // </param>
+ // </params>
+ //</methodCall>";
+ // StringReader sr = new StringReader(xml);
+ // XmlRpcSerializer serializer = new XmlRpcSerializer();
+ // XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ // }
+ //
+ // public void testReversedMembersStruct()
+ // {
+ // string xml = @"<?xml version=""1.0"" ?>
+ //<methodCall>
+ // <methodName>TestStruct</methodName>
+ // <params>
+ // <param>
+ // </param>
+ // </params>
+ //</methodCall>";
+ // StringReader sr = new StringReader(xml);
+ // XmlRpcSerializer serializer = new XmlRpcSerializer();
+ // XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ // }
+ //
+ // public void testWrongTypeMembersStruct()
+ // {
+ // string xml = @"<?xml version=""1.0"" ?>
+ //<methodCall>
+ // <methodName>TestStruct</methodName>
+ // <params>
+ // <param>
+ // </param>
+ // </params>
+ //</methodCall>";
+ // StringReader sr = new StringReader(xml);
+ // XmlRpcSerializer serializer = new XmlRpcSerializer();
+ // XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ // }
+ //
+ // public void testDuplicateMembersStruct()
+ // {
+ // string xml = @"<?xml version=""1.0"" ?>
+ //<methodCall>
+ // <methodName>TestStruct</methodName>
+ // <params>
+ // <param>
+ // </param>
+ // </params>
+ //</methodCall>";
+ // StringReader sr = new StringReader(xml);
+ // XmlRpcSerializer serializer = new XmlRpcSerializer();
+ // XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ // }
+ //
+ // public void testNonAsciiMemberNameStruct()
+ // {
+ // string xml = @"<?xml version=""1.0"" ?>
+ //<methodCall>
+ // <methodName>TestStruct</methodName>
+ // <params>
+ // <param>
+ // </param>
+ // </params>
+ //</methodCall>";
+ // StringReader sr = new StringReader(xml);
+ // XmlRpcSerializer serializer = new XmlRpcSerializer();
+ // XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ // }
+ //
+ // // test various invalid requests
+ // public void testIncorrectParamType()
+ // {
+ // string xml = @"<?xml version=""1.0"" ?>
+ //<methodCall>
+ // <methodName>TestStruct</methodName>
+ // <params>
+ // <param>
+ // </param>
+ // </params>
+ //</methodCall>";
+ // StringReader sr = new StringReader(xml);
+ // XmlRpcSerializer serializer = new XmlRpcSerializer();
+ // XmlRpcRequest request = serializer.DeserializeRequest(sr, null);
+ // }
+
+
+
+ public class TestClass
+ {
+ public int _int;
+ public string _string;
+ }
+
+ [XmlRpcMethod]
+ public void TestClassMethod(TestClass testClass)
+ {
+ }
+
+ [Test]
+ public void Class()
+ {
+ string xml = @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>TestClassMethod</methodName>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>_int</name>
+ <value>
+ <i4>456</i4>
+ </value>
+ </member>
+ <member>
+ <name>_string</name>
+ <value>
+ <string>Test Class</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, GetType());
+
+ Assert.AreEqual(request.args[0].GetType(), typeof(TestClass),
+ "argument is TestClass");
+// XmlRpcStruct xrs = (XmlRpcStruct)request.args[0];
+// Assert.IsTrue(xrs.Count == 4, "XmlRpcStruct has 4 members");
+// Assert.IsTrue(xrs.ContainsKey("member1") && (int)xrs["member1"] == 1,
+// "member1");
+// Assert.IsTrue(xrs.ContainsKey("member2") && (int)xrs["member2"] == 2,
+// "member2");
+// Assert.IsTrue(xrs.ContainsKey("member-3") && (int)xrs["member-3"] == 3,
+// "member-3");
+// Assert.IsTrue(xrs.ContainsKey("member-4") && (int)xrs["member-4"] == 4,
+// "member-4");
+
+ }
+
+
+ public struct simple
+ {
+ public int number;
+ public string detail;
+ }
+
+ [XmlRpcMethod("rtx.useArrayOfStruct")]
+ public string UseArrayOfStruct(simple[] myarr)
+ {
+ return "";
+ }
+
+ [Test]
+ public void Blakemore()
+ {
+ string xml = @"<?xml version=""1.0""?>
+<methodCall><methodName>rtx.useArrayOfStruct</methodName>
+<params>
+<param><value><array>
+<data><value>
+<struct><member><name>detail</name><value><string>elephant</string></value></member><member><name>number</name><value><int>76</int></value></member></struct>
+</value></data>
+<data><value>
+<struct><member><name>detail</name><value><string>rhino</string></value></member><member><name>number</name><value><int>33</int></value></member></struct>
+</value></data>
+<data><value>
+<struct><member><name>detail</name><value><string>porcupine</string></value></member><member><name>number</name><value><int>106</int></value></member></struct>
+</value></data>
+</array></value></param>
+</params></methodCall>";
+
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, GetType());
+
+ Assert.AreEqual(request.args[0].GetType(), typeof(simple[]),
+ "argument is simple[]");
+ Assert.IsTrue((request.args[0] as simple[]).Length == 1,
+ "argument is simple[] of length 1");
+
+ }
+
+ }
+}
+
+
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/deserializeresponsetest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/deserializeresponsetest.cs
new file mode 100644
index 0000000..0e45b31
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/deserializeresponsetest.cs
@@ -0,0 +1,1333 @@
+using System;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+ [TestFixture]
+ public class DeserializeResponseTest
+ {
+
+ // test return integer
+ [Test]
+ public void I4NullType()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><i4>12345</i4></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, null);
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is int, "retval is int");
+ Assert.AreEqual((int)o, 12345, "retval is 12345");
+ }
+
+ [Test]
+ public void I4WithType()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><i4>12345</i4></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(int));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is int, "retval is int");
+ Assert.AreEqual((int)o, 12345, "retval is 12345");
+ }
+
+ [Test]
+ public void IntegerNullType()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><int>12345</int></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, null);
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is int, "retval is int");
+ Assert.AreEqual((int)o, 12345, "retval is 12345");
+ }
+
+ [Test]
+ public void IntegerWithType()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><int>12345</int></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(int));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is int, "retval is int");
+ Assert.AreEqual((int)o, 12345, "retval is 12345");
+ }
+
+ [Test]
+ public void IntegerIncorrectType()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><int>12345</int></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(string));
+ Assert.Fail("Should throw XmlRpcTypeMismatchException");
+ }
+ catch (XmlRpcTypeMismatchException)
+ {
+ }
+ }
+
+ // test return double
+
+ // test return boolean
+
+ // test return string
+ [Test]
+ public void StringNullType()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><string>test string</string></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, null);
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is string, "retval is string");
+ Assert.AreEqual((string)o, "test string", "retval is 'test string'");
+ }
+
+ [Test]
+ public void String2NullType()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value>test string</value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, null);
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is string, "retval is string");
+ Assert.AreEqual((string)o, "test string", "retval is 'test string'");
+ }
+
+ [Test]
+ public void String1WithType()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><string>test string</string></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(string));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is string, "retval is string");
+ Assert.AreEqual((string)o, "test string", "retval is 'test string'");
+ }
+
+ [Test]
+ public void String2WithType()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value>test string</value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(string));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is string, "retval is string");
+ Assert.AreEqual((string)o, "test string", "retval is 'test string'");
+ }
+
+ [Test]
+ public void String1IncorrectType()
+ {
+ try
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value>test string</value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(int));
+ Assert.Fail("Should throw XmlRpcTypeMismatchException");
+ }
+ catch(XmlRpcTypeMismatchException)
+ {
+ }
+ }
+
+ [Test]
+ public void StringEmptyValue()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value/>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(string));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is string, "retval is string");
+ Assert.AreEqual((string)o, "", "retval is empty string");
+ }
+
+
+
+ // test return dateTime
+
+ [Test]
+ public void MinDateTime1NotStrict()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><dateTime.iso8601>00000000T00:00:00</dateTime.iso8601></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.MapZerosDateTimeToMinValue;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(DateTime));
+ Object o = response.retVal;
+ Assert.IsTrue(o is DateTime, "retval is string");
+ Assert.AreEqual((DateTime)o, DateTime.MinValue, "DateTime.MinValue");
+ }
+
+ [Test]
+ public void MinDateTime2NotStrict()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><dateTime.iso8601>00000000T00:00:00Z</dateTime.iso8601></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.MapZerosDateTimeToMinValue;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(DateTime));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o is DateTime, "retval is string");
+ Assert.AreEqual((DateTime)o, DateTime.MinValue, "DateTime.MinValue");
+ }
+
+ [Test]
+ public void MinDateTime3NotStrict()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><dateTime.iso8601>0000-00-00T00:00:00</dateTime.iso8601></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.MapZerosDateTimeToMinValue;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(DateTime));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o is DateTime, "retval is string");
+ Assert.AreEqual((DateTime)o, DateTime.MinValue, "DateTime.MinValue");
+ }
+
+ [Test]
+ public void MinDateTime4NotStrict()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><dateTime.iso8601>0000-00-00T00:00:00Z</dateTime.iso8601></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.MapZerosDateTimeToMinValue;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(DateTime));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o is DateTime, "retval is string");
+ Assert.AreEqual((DateTime)o, DateTime.MinValue, "DateTime.MinValue");
+ }
+
+ [Test]
+ public void MinDateTimeStrict()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><dateTime.iso8601>00000000T00:00:00</dateTime.iso8601></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.AllowNonStandardDateTime;
+ try
+ {
+ XmlRpcResponse response = serializer.DeserializeResponse(sr,
+ typeof(DateTime));
+ Assert.Fail("dateTime 00000000T00:00:00 invalid when strict");
+ }
+ catch (XmlRpcInvalidXmlRpcException)
+ {
+ }
+ }
+
+ // test return base64
+
+
+ // test return array
+
+
+ // test return struct
+
+
+ [Test]
+ public void ReturnStructAsObject()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>key3</name>
+ <value>
+ <string>this is a test</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodResponse>";
+
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response
+ = serializer.DeserializeResponse(sr, typeof(object));
+
+ Object o = response.retVal;
+ string ret = (string)((XmlRpcStruct)o)["key3"];
+ }
+
+
+ [Test]
+ public void ReturnStructAsXmlRpcStruct()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>key3</name>
+ <value>
+ <string>this is a test</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodResponse>";
+
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response
+ = serializer.DeserializeResponse(sr, typeof(XmlRpcStruct));
+
+ Object o = response.retVal;
+ string ret = (string)((XmlRpcStruct)o)["key3"];
+ }
+
+
+
+ [Test]
+ public void ArrayInStruct()
+ {
+ // reproduce problem reported by Alexander Agustsson
+ string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>key3</name>
+ <value>
+ <array>
+ <data>
+ <value>New Milk</value>
+ <value>Old Milk</value>
+ </data>
+ </array>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodResponse>";
+
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, null);
+
+ Object o = response.retVal;
+ Assert.IsTrue(o is XmlRpcStruct, "retval is XmlRpcStruct");
+ XmlRpcStruct xrs = (XmlRpcStruct)o;
+ Assert.IsTrue(xrs.Count == 1, "retval contains one entry");
+ object elem = xrs["key3"];
+ Assert.IsTrue(elem != null, "element has correct key");
+ Assert.IsTrue(elem is Array, "element is an array");
+ object[] array = (object[])elem;
+ Assert.IsTrue(array.Length == 2, "array has 2 members");
+ Assert.IsTrue(array[0] is string && (string)array[0] == "New Milk"
+ && array[1] is string && (string)array[1] == "Old Milk",
+ "values of array members");
+ }
+
+
+ [Test]
+ public void StringAndStructInArray()
+ {
+ // reproduce problem reported by Eric Brittain
+ string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <array>
+ <data>
+ <value>
+ <string>test string</string>
+ </value>
+ <value>
+ <struct>
+ <member>
+ <name>fred</name>
+ <value><string>test string 2</string></value>
+ </member>
+ </struct>
+ </value>
+ </data>
+ </array>
+ </value>
+ </param>
+ </params>
+</methodResponse>";
+
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, null);
+ Object o = response.retVal;
+
+ }
+
+
+
+ public struct InternalStruct
+ {
+ public string firstName;
+ public string lastName;
+ }
+
+ public struct MyStruct
+ {
+ public string version;
+ public InternalStruct record;
+ }
+
+ [Test]
+ public void ReturnNestedStruct()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>version</name>
+ <value><string>1.6</string></value>
+ </member>
+ <member>
+ <name>record</name>
+ <value>
+ <struct>
+ <member>
+ <name>firstName</name>
+ <value>Joe</value></member>
+ <member>
+ <name>lastName</name>
+ <value>Test</value>
+ </member>
+ </struct>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodResponse>";
+
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response
+ = serializer.DeserializeResponse(sr, typeof(MyStruct));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o is MyStruct, "retval is MyStruct");
+ MyStruct mystr = (MyStruct)o;
+ Assert.AreEqual(mystr.version, "1.6", "version is 1.6");
+ Assert.IsTrue(mystr.record.firstName == "Joe", "firstname is Joe");
+ Assert.IsTrue(mystr.record.lastName == "Test", "lastname is Test");
+ }
+
+ [Test]
+ public void JoseProblem()
+ {
+
+ string xml = @"<?xml version='1.0'?>
+<methodResponse>
+<params>
+<param>
+<value><int>12</int></value>
+</param>
+</params>
+
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response
+ = serializer.DeserializeResponse(sr, typeof(int));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o is int, "retval is int");
+ int myint = (int)o;
+ Assert.AreEqual(myint, 12, "int is 12");
+ }
+
+ struct BillStruct
+ {
+ public int x;
+ public string s;
+ }
+
+ [Test]
+ public void MissingStructMember()
+ {
+ string xml = @"<?xml version='1.0'?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>x</name>
+ <value>
+ <i4>123</i4>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ try
+ {
+ XmlRpcResponse response
+ = serializer.DeserializeResponse(sr, typeof(BillStruct));
+ Assert.Fail("Should detect missing struct member");
+ }
+ catch(AssertionException)
+ {
+ throw;
+ }
+ catch(Exception)
+ {
+ }
+ }
+
+ [Test]
+ public void BillKeenanProblem()
+ {
+ string xml = @"<?xml version='1.0'?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>x</name>
+ <value>
+ <i4>123</i4>
+ </value>
+ </member>
+ <member>
+ <name>s</name>
+ <value>
+ <string>ABD~~DEF</string>
+ </value>
+ </member>
+ <member>
+ <name>unexpected</name>
+ <value>
+ <string>this is unexpected</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response
+ = serializer.DeserializeResponse(sr, typeof(BillStruct));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o is BillStruct, "retval is BillStruct");
+ BillStruct bs = (BillStruct)o;
+ Assert.IsTrue(bs.x == 123 && bs.s == "ABD~~DEF", "struct members");
+ }
+
+ [Test]
+ public void AdvogatoProblem()
+ {
+ string xml = @"<?xml version='1.0'?>
+<methodResponse>
+<params>
+<param>
+<array>
+<data>
+<value>
+<dateTime.iso8601>20020707T11:25:37</dateTime.iso8601>
+</value>
+<value>
+<dateTime.iso8601>20020707T11:37:12</dateTime.iso8601>
+</value>
+</data>
+</array>
+</param>
+</params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ try
+ {
+ XmlRpcResponse response
+ = serializer.DeserializeResponse(sr, null);
+ Object o = response.retVal;
+ Assert.Fail("should have thrown XmlRpcInvalidXmlRpcException");
+ }
+ catch(XmlRpcInvalidXmlRpcException)
+ {
+ }
+ }
+
+ [Test]
+ public void VoidReturnType()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value></value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(void));
+ Assert.IsTrue(response.retVal == null, "retval is null");
+ }
+
+ [Test]
+ public void EmptyValueReturn()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value/>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(string));
+ string s = (string)response.retVal;
+ Assert.IsTrue(s == "", "retval is empty string");
+ }
+
+
+ public struct XmlRpcClassifyRequest
+ {
+ public int q_id;
+ public string docid;
+ public string query;
+ public string [] cattypes;
+ public int topscores;
+ public int timeout;
+ }
+
+ public struct user_info
+ {
+ public string username;
+ public string password;
+ public string hostname;
+ public string ip;
+ }
+
+ public struct XmlRpcClassifyResult
+ {
+ public XmlRpcCatData [] categories;
+ public string error_msg;
+ public int error_code;
+ public double exec_time;
+ public int q_id;
+ public string cattype;
+ }
+
+ public struct XmlRpcCatData
+ {
+ public int rank;
+ public int cat_id;
+ public string cat_title;
+ public double composite_score;
+ public string meta_info;
+ public double [] component_scores;
+ }
+
+ [Test]
+ public void ISO_8869_1()
+ {
+ using(Stream stm = new FileStream("../iso-8859-1_response.xml",
+ FileMode.Open, FileAccess.Read))
+ {
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response
+ = serializer.DeserializeResponse(stm, typeof(String));
+ String ret = (String)response.retVal;
+ int nnn = ret.Length;
+ Assert.IsTrue(ret == "hæ hvað segirðu þá",
+ "retVal is 'hæ hvað segirðu þá'");
+ }
+ }
+
+ [Test]
+ public void FaultResponse()
+ {
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <fault>
+ <value>
+ <struct>
+ <member>
+ <name>faultCode</name>
+ <value><int>4</int></value>
+ </member>
+ <member>
+ <name>faultString</name>
+ <value><string>Too many parameters.</string></value>
+ </member>
+ </struct>
+ </value>
+ </fault>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ try
+ {
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(void));
+ }
+ catch (XmlRpcFaultException fex)
+ {
+ Assert.AreEqual(fex.FaultCode, 4);
+ Assert.AreEqual(fex.FaultString, "Too many parameters.");
+ }
+ }
+
+ [Test]
+ public void FaultStringCode()
+ {
+ // Alex Hung reported that some servers, e.g. WordPress, return fault code
+ // as a string
+ string xml = @"<?xml version=""1.0"" ?>
+<methodResponse>
+ <fault>
+ <value>
+ <struct>
+ <member>
+ <name>faultCode</name>
+ <value><string>4</string></value>
+ </member>
+ <member>
+ <name>faultString</name>
+ <value><string>Too many parameters.</string></value>
+ </member>
+ </struct>
+ </value>
+ </fault>
+</methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ try
+ {
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(void));
+ }
+ catch (XmlRpcFaultException fex)
+ {
+ Assert.AreEqual(fex.FaultCode, 4);
+ Assert.AreEqual(fex.FaultString, "Too many parameters.");
+ }
+ }
+
+ [Test]
+ public void Yolanda()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?><methodResponse><params><param><value><array><data><value>addressbook</value><value>system</value></data></array></value></param></params></methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr, null);
+
+ Object o = response.retVal;
+ }
+
+ [Test]
+ public void Gabe()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""UTF-8""?><methodResponse><params><param><value><struct><member><name>response</name><value><struct><member><name>result</name><value><array><data><value><struct><member><name>state</name><value><string>CO</string></value></member><member><name>latitude</name><value><double>39.74147878</double></value></member><member><name>add1</name><value><string>110 16th St.</string></value></member><member><name>add2</name><value><string /></value></member><member><name>image_map</name><value><array><data><value><string>rect</string></value><value><int>290</int></value><value><int>190</int></value><value><int>309</int></value><value><int>209</int></value></data></array></value></member><member><name>city</name><value><string>Denver</string></value></member><member><name>fax</name><value><string>303-623-1111</string></value></member><member><name>name</name><value><boolean>0"
++ "</boolean></value></member><member><name>longitude</name><value><double>-104.9874159</double></value></member><member><name>georesult</name><value><string>10 W2GIADDRESS</string></value></member><member><name>zip</name><value><string>80202</string></value></member><member><name>hours</name><value><string>Mon-Sun 10am-6pm</string></value></member><member><name>dealerid</name><value><string>545</string></value></member><member><name>phone</name><value><string>303-623-5050</string></value></member></struct></value></data></array></value></member><member><name>map_id</name><value><string>a5955239d080dfbb7002fd063aa7b47e0d</string></value></member><member><name>map</name><value><struct><member><name>zoom_level</name><value><int>3</int></value></member><member><name>image_type</name><value><string>image/png</string></value></member><member><name>miles</name><value><double>1.75181004463519</double></value></member><member><name>kilometers</name><value><double>2.81926498447338"
++ "</double></value></member><member><name>scalebar</name><value><int>1</int></value></member><member><name>content</name><value><string>http://mapserv.where2getit.net/maptools/mapserv.cgi/a5955239d080dfbb7002fd063aa7b47e0d.png</string></value></member><member><name>scale</name><value><int>26000</int></value></member><member><name>map_style</name><value><string>default</string></value></member><member><name>size</name><value><array><data><value><int>600</int></value><value><int>400</int></value></data></array></value></member><member><name>content_type</name><value><string>text/uri-list</string></value></member><member><name>buffer</name><value><double>0.01</double></value></member><member><name>center</name><value><struct><member><name>georesult</name><value><string>AUTOBBOX</string></value></member><member><name>latitude</name><value><double>39.74147878</double></value></member><member><name>longitude</name><value><double>-104.9874159</double></value></member></struct></value></member></struct></value></member><member><name>result_count</name><value><int>1</int></value></member><member><name>image_map</name><value><boolean>1</boolean></value></member><member><name>result_total_count</name><value><int>1</int></value></member></struct></value></member><member><name>times</name><value><struct><member><name>csys</name><value><int>0</int></value></member><member><name>cusr</name><value><int>0</int></value></member><member><name>sys</name><value><int>0</int></value></member><member><name>usr</name><value><double>0.0200000000000005"
+ + "</double></value></member><member><name>wallclock</name><value><double>2.547471</double></value></member></struct></value></member><member><name>request</name><value><struct><member><name>state</name><value><string>CO</string></value></member><member><name>%sort</name><value><array><data /></array></value></member><member><name>%id</name><value><string>4669b341d87be7f450b4bf0dc4cd0a1e</string></value></member><member><name>city</name><value><string>denver</string></value></member><member><name>%limit</name><value><int>10</int></value></member><member><name>%offset</name><value><int>0</int></value></member></struct></value></member></struct></value></param></params></methodResponse>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(sr,
+ typeof(XmlRpcStruct));
+
+ XmlRpcStruct response_struct = (XmlRpcStruct)response.retVal;
+ XmlRpcStruct _response = (XmlRpcStruct)response_struct["response"];
+ Array results = (Array)_response["result"];
+ Assert.AreEqual(results.Length, 1);
+ }
+
+ struct DupMem
+ {
+ public string foo;
+ }
+
+ [Test]
+ public void StructDuplicateMember()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>foo</name>
+ <value>
+ <string>this is a test</string>
+ </value>
+ </member>
+ <member>
+ <name>foo</name>
+ <value>
+ <string>duplicate this is a test</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr1 = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ try
+ {
+ XmlRpcResponse response1 = serializer.DeserializeResponse(sr1, typeof(DupMem));
+ Assert.Fail("Ignored duplicate member");
+ }
+ catch (XmlRpcInvalidXmlRpcException)
+ {
+ }
+ serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
+ StringReader sr2 = new StringReader(xml);
+ XmlRpcResponse response2 = serializer.DeserializeResponse(sr2, typeof(DupMem));
+ DupMem dupMem = (DupMem)response2.retVal;
+ Assert.AreEqual(dupMem.foo, "this is a test");
+ }
+
+ [Test]
+ public void XmlRpcStructDuplicateMember()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>foo</name>
+ <value>
+ <string>this is a test</string>
+ </value>
+ </member>
+ <member>
+ <name>foo</name>
+ <value>
+ <string>duplicate this is a test</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodResponse>";
+ StringReader sr1 = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ try
+ {
+ XmlRpcResponse response1 = serializer.DeserializeResponse(sr1, typeof(XmlRpcStruct));
+ Assert.Fail("Ignored duplicate member");
+ }
+ catch (XmlRpcInvalidXmlRpcException)
+ {
+
+ }
+ serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
+ StringReader sr2 = new StringReader(xml);
+ XmlRpcResponse response2 = serializer.DeserializeResponse(sr2, typeof(XmlRpcStruct));
+ XmlRpcStruct dupMem = (XmlRpcStruct)response2.retVal;
+ Assert.IsTrue((string)dupMem["foo"] == "this is a test");
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcIllFormedXmlException))]
+ public void InvalidHTTPContentLeadingWhiteSpace()
+ {
+ string xml = @"
+
+
+<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><i4>12345</i4></value>
+ </param>
+ </params>
+</methodResponse>";
+
+ Stream stm = new MemoryStream();
+ StreamWriter wrtr = new StreamWriter(stm, Encoding.ASCII);
+ wrtr.Write(xml);
+ wrtr.Flush();
+ stm.Position = 0;
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(stm, typeof(int));
+ }
+
+ [Test]
+ public void AllowInvalidHTTPContentLeadingWhiteSpace()
+ {
+ string xml = @"
+
+
+<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><i4>12345</i4></value>
+ </param>
+ </params>
+</methodResponse>";
+ Stream stm = new MemoryStream();
+ StreamWriter wrtr = new StreamWriter(stm, Encoding.ASCII);
+ wrtr.Write(xml);
+ wrtr.Flush();
+ stm.Position = 0;
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.AllowInvalidHTTPContent;
+ XmlRpcResponse response = serializer.DeserializeResponse(stm, typeof(int));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is int, "retval is int");
+ Assert.AreEqual((int)o, 12345, "retval is 12345");
+ }
+
+ [Test]
+ public void AllowInvalidHTTPContentTrailingWhiteSpace()
+ {
+ string xml = @"
+
+
+<?xml version=""1.0"" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value><i4>12345</i4></value>
+ </param>
+ </params>
+</methodResponse>";
+
+ Stream stm = new MemoryStream();
+ StreamWriter wrtr = new StreamWriter(stm, Encoding.ASCII);
+ wrtr.Write(xml);
+ wrtr.Flush();
+ stm.Position = 0;
+
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.AllowInvalidHTTPContent;
+ XmlRpcResponse response = serializer.DeserializeResponse(stm, typeof(int));
+
+ Object o = response.retVal;
+ Assert.IsTrue(o != null, "retval not null");
+ Assert.IsTrue(o is int, "retval is int");
+ Assert.AreEqual((int)o, 12345, "retval is 12345");
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcIllFormedXmlException))]
+ public void InvalidXML()
+ {
+ string xml = @"response>";
+ Stream stm = new MemoryStream();
+ StreamWriter wrtr = new StreamWriter(stm, Encoding.ASCII);
+ wrtr.Write(xml);
+ wrtr.Flush();
+ stm.Position = 0;
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcResponse response = serializer.DeserializeResponse(stm, typeof(int));
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcIllFormedXmlException))]
+ public void InvalidXMLWithAllowInvalidHTTPContent()
+ {
+ string xml = @"response>";
+ Stream stm = new MemoryStream();
+ StreamWriter wrtr = new StreamWriter(stm, Encoding.ASCII);
+ wrtr.Write(xml);
+ wrtr.Flush();
+ stm.Position = 0;
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.AllowInvalidHTTPContent;
+ XmlRpcResponse response = serializer.DeserializeResponse(stm, typeof(int));
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcIllFormedXmlException))]
+ public void OneByteContentAllowInvalidHTTPContent()
+ {
+ string xml = @"<";
+ Stream stm = new MemoryStream();
+ StreamWriter wrtr = new StreamWriter(stm, Encoding.ASCII);
+ wrtr.Write(xml);
+ wrtr.Flush();
+ stm.Position = 0;
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.AllowInvalidHTTPContent;
+ XmlRpcResponse response = serializer.DeserializeResponse(stm, typeof(int));
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcIllFormedXmlException))]
+ public void ZeroByteContentAllowInvalidHTTPContent()
+ {
+ string xml = @"";
+ Stream stm = new MemoryStream();
+ StreamWriter wrtr = new StreamWriter(stm, Encoding.ASCII);
+ wrtr.Write(xml);
+ wrtr.Flush();
+ stm.Position = 0;
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.AllowInvalidHTTPContent;
+ XmlRpcResponse response = serializer.DeserializeResponse(stm, typeof(int));
+ }
+
+
+ [Test]
+ public void Donhrobjartz_XmlRpcStructNonMemberStructChild()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>
+<methodResponse>
+<params>
+<param>
+<value>
+<struct>
+<foo>
+This should be ignored.
+</foo>
+<member>
+<name>period</name>
+<value><string>1w</string></value>
+</member>
+<bar>
+This should be ignored.
+</bar>
+</struct>
+</value>
+</param>
+</params>
+</methodResponse>";
+ StringReader sr1 = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr1,
+ typeof(XmlRpcStruct));
+ XmlRpcStruct ret = (XmlRpcStruct)response.retVal;
+ Assert.AreEqual(ret.Count,1);
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcInvalidXmlRpcException))]
+ public void Donhrobjartz_XmlRpcStructMemberDupName()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>
+<methodResponse>
+<params>
+<param>
+<value>
+<struct>
+<member>
+<name>period</name>
+<value><string>1w</string></value>
+<name>price</name>
+</member>
+</struct>
+</value>
+</param>
+</params>
+</methodResponse>";
+ StringReader sr1 = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr1,
+ typeof(XmlRpcStruct));
+ XmlRpcStruct ret = (XmlRpcStruct)response.retVal;
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcInvalidXmlRpcException))]
+ public void Donhrobjartz_XmlRpcStructMemberDupValue()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>
+<methodResponse>
+<params>
+<param>
+<value>
+<struct>
+<member>
+<name>period</name>
+<value><string>1w</string></value>
+<value><string>284</string></value>
+</member>
+</struct>
+</value>
+</param>
+</params>
+</methodResponse>";
+ StringReader sr1 = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr1,
+ typeof(XmlRpcStruct));
+ XmlRpcStruct ret = (XmlRpcStruct)response.retVal;
+ }
+
+ struct Donhrobjartz
+ {
+ public string period;
+ }
+
+ [Test]
+ public void Donhrobjartz_StructNonMemberStructChild()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>
+<methodResponse>
+<params>
+<param>
+<value>
+<struct>
+<foo>
+This should be ignored.
+</foo>
+<member>
+<name>period</name>
+<value><string>1w</string></value>
+</member>
+<bar>
+This should be ignored.
+</bar>
+</struct>
+</value>
+</param>
+</params>
+</methodResponse>";
+ StringReader sr1 = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr1,
+ typeof(Donhrobjartz));
+ Donhrobjartz ret = (Donhrobjartz)response.retVal;
+ Assert.AreEqual(ret.period, "1w");
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcInvalidXmlRpcException))]
+ public void Donhrobjartz_StructMemberDupName()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>
+<methodResponse>
+<params>
+<param>
+<value>
+<struct>
+<member>
+<name>period</name>
+<value><string>1w</string></value>
+<name>price</name>
+</member>
+</struct>
+</value>
+</param>
+</params>
+</methodResponse>";
+ StringReader sr1 = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr1,
+ typeof(Donhrobjartz));
+ Donhrobjartz ret = (Donhrobjartz)response.retVal;
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcInvalidXmlRpcException))]
+ public void Donhrobjartz_StructMemberDupValue()
+ {
+ string xml = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>
+<methodResponse>
+<params>
+<param>
+<value>
+<struct>
+<member>
+<name>period</name>
+<value><string>1w</string></value>
+<value><string>284</string></value>
+</member>
+</struct>
+</value>
+</param>
+</params>
+</methodResponse>";
+ StringReader sr1 = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
+ XmlRpcResponse response = serializer.DeserializeResponse(sr1,
+ typeof(Donhrobjartz));
+ Donhrobjartz ret = (Donhrobjartz)response.retVal;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/invoketest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/invoketest.cs
new file mode 100644
index 0000000..7d7faf2
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/invoketest.cs
@@ -0,0 +1,206 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Reflection;
+using System.Threading;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+public struct TestStruct
+{
+ public int x;
+ public int y;
+}
+
+[XmlRpcUrl("http://localhost/test/")]
+class Foo : XmlRpcClientProtocol
+{
+ [XmlRpcMethod]
+ public int Send_Param(object[] toSend)
+ {
+ return (int)Invoke("Send_Param", toSend);
+ }
+
+ [XmlRpcMethod]
+ public int SendTwoParams(int param1, int param2)
+ {
+ return (int)Invoke("SendTwoParams", new object[] { param1 } );
+ }
+
+ [XmlRpcMethod]
+ public string Send(string str)
+ {
+ return (string)Invoke("Send", new object[] { str });
+ }
+
+ [XmlRpcMethod]
+ public string Send(TestStruct strct)
+ {
+ return (string)Invoke("Send", new object[] { strct });
+ }
+}
+
+[XmlRpcUrl("http://localhost:8005/statename.rem")]
+class StateName : XmlRpcClientProtocol
+{
+ [XmlRpcMethod("examples.getStateName")]
+ public string GetStateNameUsingMethodName(int stateNumber)
+ {
+ return (string)Invoke("GetStateNameUsingMethodName",
+ new object[] { stateNumber });
+ }
+
+ [XmlRpcMethod("examples.getStateNameFromString")]
+ public string GetStateNameUsingMethodName(string stateNumber)
+ {
+ return (string)Invoke("GetStateNameUsingMethodName",
+ new object[] { stateNumber });
+ }
+
+ [XmlRpcMethod("examples.getStateName")]
+ public string GetStateNameUsingMethodInfo(int stateNumber)
+ {
+ return (string)Invoke(MethodBase.GetCurrentMethod(),
+ new object[] { stateNumber });
+ }
+
+ [XmlRpcMethod("examples.getStateNameFromString")]
+ public string GetStateNameUsingMethodInfo(string stateNumber)
+ {
+ return (string)Invoke(MethodBase.GetCurrentMethod(),
+ new object[] { stateNumber });
+ }
+
+ [XmlRpcMethod("examples.getStateName")]
+ public IAsyncResult BeginGetStateName(int stateNumber, AsyncCallback callback,
+ object asyncState)
+ {
+ return BeginInvoke(MethodBase.GetCurrentMethod(),
+ new object[] { stateNumber }, callback, asyncState);
+ }
+
+ [XmlRpcMethod("examples.getStateName")]
+ public IAsyncResult BeginGetStateName(int stateNumber)
+ {
+ return BeginInvoke(MethodBase.GetCurrentMethod(),
+ new object[] { stateNumber }, null, null);
+ }
+
+ public string EndGetStateName(IAsyncResult asr)
+ {
+ return (string)EndInvoke(asr);
+ }
+}
+
+namespace ntest
+{
+ [TestFixture]
+ public class InvokeTest
+ {
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ StateNameService.Start(8005);
+ }
+
+ [TestFixtureTearDown]
+ public void TearDown()
+ {
+ StateNameService.Stop();
+ }
+
+ [Test]
+ public void MakeSynchronousCalls()
+ {
+ StateName proxy = new StateName();
+ string ret1 = proxy.GetStateNameUsingMethodName(1);
+ Assert.AreEqual("Alabama", ret1);
+ string ret2 = proxy.GetStateNameUsingMethodInfo(1);
+ Assert.AreEqual("Alabama", ret2);
+ string ret3 = proxy.GetStateNameUsingMethodName("1");
+ Assert.AreEqual("Alabama", ret3);
+ string ret4 = proxy.GetStateNameUsingMethodInfo("1");
+ Assert.AreEqual("Alabama", ret4);
+ }
+
+ class CBInfo
+ {
+ public ManualResetEvent _evt;
+ public Exception _excep;
+ public string _ret;
+ public CBInfo(ManualResetEvent evt)
+ {
+ _evt = evt;
+ }
+ }
+
+ void StateNameCallback(IAsyncResult asr)
+ {
+ XmlRpcAsyncResult clientResult = (XmlRpcAsyncResult)asr;
+ StateName proxy = (StateName)clientResult.ClientProtocol;
+ CBInfo info = (CBInfo)asr.AsyncState;
+ try
+ {
+ info._ret = proxy.EndGetStateName(asr);
+ }
+ catch (Exception ex)
+ {
+ info._excep = ex;
+ }
+ info._evt.Set();
+ }
+
+ [Test]
+ public void MakeAsynchronousCallIsCompleted()
+ {
+ StateName proxy = new StateName() ;
+ IAsyncResult asr1 = proxy.BeginGetStateName(1);
+ while (asr1.IsCompleted == false)
+ System.Threading.Thread.Sleep(10);
+ string ret1 = proxy.EndGetStateName(asr1);
+ Assert.AreEqual("Alabama", ret1);
+ }
+
+ [Test]
+ public void MakeAsynchronousCallWait()
+ {
+ StateName proxy = new StateName();
+ IAsyncResult asr2 = proxy.BeginGetStateName(1);
+ asr2.AsyncWaitHandle.WaitOne();
+ string ret2 = proxy.EndGetStateName(asr2);
+ Assert.AreEqual("Alabama", ret2);
+ }
+
+ [Test]
+ public void MakeAsynchronousCallCallBack()
+ {
+ StateName proxy = new StateName();
+ ManualResetEvent evt = new ManualResetEvent(false);
+ CBInfo info = new CBInfo(evt);
+ IAsyncResult asr3 = proxy.BeginGetStateName(1, StateNameCallback, info);
+ evt.WaitOne();
+ Assert.AreEqual(null, info._excep, "Async call threw exception");
+ Assert.AreEqual("Alabama", info._ret);
+ }
+
+ // TODO: add sync fault exception
+ // TODO: add async fault exception
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcInvalidParametersException))]
+ public void Massimo()
+ {
+ object[] parms = new object[12] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
+ Foo foo = new Foo();
+ foo.Send_Param(parms);
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcNullParameterException))]
+ public void NullArg()
+ {
+ Foo foo = new Foo();
+ foo.Send(null);
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/iso-8859-1_request.xml b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/iso-8859-1_request.xml
new file mode 100644
index 0000000..afec5cb
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/iso-8859-1_request.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<methodCall>
+ <methodName>test.ISO-8859-1</methodName>
+ <params>
+ <param>
+ <value><string>hæ hvað segirðu þá</string></value>
+ </param>
+ </params>
+</methodCall> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/iso-8859-1_response.xml b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/iso-8859-1_response.xml
new file mode 100644
index 0000000..f124c74
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/iso-8859-1_response.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<methodResponse>
+ <params>
+ <param>
+ <value>hæ hvað segirðu þá</value>
+ </param>
+ </params>
+</methodResponse> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/ntest.csproj b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/ntest.csproj
new file mode 100644
index 0000000..7243625
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/ntest.csproj
@@ -0,0 +1,155 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A03FD7C0-77B4-4731-8818-6E33A0A83E70}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>ntest</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>ntest</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>bin\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>649</NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>bin\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>649</NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="CookComputing.XmlRpcV2, Version=0.0.0.0, Culture=neutral" Condition="'$(TargetFX1_0)'!='true'">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\bin\CookComputing.XmlRpcV2.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework, Version=2.2.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\Program Files\nunit\bin\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Runtime.Remoting" />
+ <Reference Include="System.Web.Services">
+ <Name>System.Web.Services</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="deserializerequesttest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="deserializeresponsetest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="invoketest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="optionaldeserializetest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="optionalserializetest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="paramstest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="parsetest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="proxygentest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="remotingservertest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="serializeresponsetest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="serializetest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="serviceinfotest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="StateNameService.cs" />
+ <Compile Include="utils.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcStructTest.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+ <Target Name="BeforeBuild">
+ <CreateItem Include="CookComputing.XmlRpc" Condition="'$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX1_0)'=='true'">
+ <Output TaskParameter="Include" ItemName="Reference" />
+ </CreateItem>
+ </Target>
+</Project> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/optionaldeserializetest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/optionaldeserializetest.cs
new file mode 100644
index 0000000..edc32bd
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/optionaldeserializetest.cs
@@ -0,0 +1,467 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Reflection;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+
+struct ChildStruct
+{
+ public int x;
+ public ChildStruct(int num) { x = num; }
+}
+
+
+class XmlRpcStruct1 : XmlRpcStruct
+{
+ public int mi;
+}
+
+namespace ntest
+{
+
+ [TestFixture]
+ public class OptionalDeserializeTest
+ {
+ struct Struct1
+ {
+ public int mi;
+ public string ms;
+ public bool mb;
+ public double md;
+ public DateTime mdt;
+ public byte[] mb64;
+ public int[] ma;
+ public XmlRpcInt xi;
+ public XmlRpcBoolean xb;
+ public XmlRpcDouble xd;
+ public XmlRpcDateTime xdt;
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ public int? nxi;
+ public bool? nxb;
+ public double? nxd;
+ public DateTime? nxdt;
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ struct Struct2
+ {
+ public int mi;
+ public string ms;
+ public bool mb;
+ public double md;
+ public DateTime mdt;
+ public byte[] mb64;
+ public int[] ma;
+ public XmlRpcInt xi;
+ public XmlRpcBoolean xb;
+ public XmlRpcDouble xd;
+ public XmlRpcDateTime xdt;
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ public int? nxi;
+ public bool? nxb;
+ public double? nxd;
+ public DateTime? nxdt;
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ struct Struct3
+ {
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int mi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public string ms;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public bool mb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public double md;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public DateTime mdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public byte[] mb64;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int[] ma;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcInt xi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcBoolean xb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcDouble xd;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcDateTime xdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int? nxi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public bool? nxb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public double? nxd;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public DateTime? nxdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ struct Struct4
+ {
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int mi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public string ms;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public bool mb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public double md;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public DateTime mdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public byte[] mb64;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int[] ma;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcInt xi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcBoolean xb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcDouble xd;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcDateTime xdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int? nxi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public bool? nxb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public double? nxd;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public DateTime? nxdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcTypeMismatchException))]
+ public void Struct1_AllMissing_Error()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><struct></struct></value>";
+ object obj = Utils.Parse(xml, typeof(Struct1), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.Fail("didn't detect missing members");
+ }
+
+ [Test]
+ public void Struct1_AllMissing_Ignore()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><struct></struct></value>";
+ object obj = Utils.Parse(xml, typeof(Struct1), MappingAction.Ignore,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is Struct1, "obj is Struct1");
+ Assert.AreEqual(0, ((Struct1)obj).mi, "int member");
+ Assert.AreEqual(null, ((Struct1)obj).ms, "string member");
+ Assert.AreEqual(false, ((Struct1)obj).mb, "boolean member");
+ Assert.AreEqual(0.0, ((Struct1)obj).md, "double member");
+ Assert.AreEqual(new DateTime(), ((Struct1)obj).mdt, "dateTime member");
+ Assert.AreEqual(null, ((Struct1)obj).mb64, "base64 member");
+ Assert.AreEqual(null, ((Struct1)obj).ma, "array member");
+ Assert.AreEqual(null, ((Struct1)obj).xi, "XmlRpcInt member");
+ Assert.AreEqual(null, ((Struct1)obj).xb, "XmlRpcBoolean member");
+ Assert.AreEqual(null, ((Struct1)obj).xd, "XmlRpcDouble member");
+ Assert.AreEqual(null, ((Struct1)obj).xdt, "XmlRpcDateTime member");
+ Assert.AreEqual(null, ((Struct1)obj).xstr, "XmlRpcStructTime member");
+#if !FX1_0
+ Assert.AreEqual(null, ((Struct1)obj).nxi, "int? member");
+ Assert.AreEqual(null, ((Struct1)obj).nxb, "bool? member");
+ Assert.AreEqual(null, ((Struct1)obj).nxd, "double? member");
+ Assert.AreEqual(null, ((Struct1)obj).nxdt, "DateTime? member");
+ Assert.AreEqual(null, ((Struct1)obj).nxstr, "ChildStruct? member");
+#endif
+ }
+
+ [Test]
+ public void Struct1_AllExist()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+<value><struct>
+<member><name>mi</name><value><i4>12345</i4></value></member>
+<member><name>ms</name><value><string>Test String</string></value></member>
+<member><name>mb</name><value><boolean>1</boolean></value></member>
+<member><name>md</name><value><double>1234.567</double></value></member>
+<member><name>mdt</name><value><dateTime.iso8601>20020707T11:25:37</dateTime.iso8601></value></member>
+<member><name>mb64</name><value><base64>AQIDBAUGBwg=</base64></value></member>
+<member><name>ma</name><value><array><data><value><i4>1</i4></value><value><i4>2</i4></value></data></array></value></member>
+<member><name>xi</name><value><i4>23456</i4></value></member>
+<member><name>xb</name><value><boolean>1</boolean></value></member>
+<member><name>xd</name><value><double>2345.678</double></value></member>
+<member><name>xdt</name><value><dateTime.iso8601>20030808T11:25:37</dateTime.iso8601></value></member>
+<member><name>xstr</name><value><struct><member><name>key3</name><value><string>test</string></value></member></struct></value></member>"
+#if !FX1_0
+ +
+@"
+<member><name>nxi</name><value><i4>34567</i4></value></member>
+<member><name>nxb</name><value><boolean>1</boolean></value></member>
+<member><name>nxd</name><value><double>3456.789</double></value></member>
+<member><name>nxdt</name><value><dateTime.iso8601>20040909T11:25:37</dateTime.iso8601></value></member>
+<member><name>nxstr</name><value><struct><member><name>x</name><value><i4>1234</i4></value></member></struct></value></member>
+"
+#endif
+ +
+@"</struct></value>";
+ object obj = Utils.Parse(xml, typeof(Struct1), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is Struct1, "obj is Struct1");
+ Assert.AreEqual(12345, ((Struct1)obj).mi, "int member");
+ Assert.AreEqual("Test String", ((Struct1)obj).ms, "string member");
+ Assert.AreEqual(true, ((Struct1)obj).mb, "boolean member");
+ Assert.AreEqual(1234.567, ((Struct1)obj).md, "double member");
+ Assert.AreEqual(new DateTime(2002, 7, 7, 11, 25, 37), ((Struct1)obj).mdt, "dateTime member");
+// TODO: Assert.AreEqual(null, ((Struct1)obj).mb64, "base64 member");
+// TODO: Assert.AreEqual(null, ((Struct1)obj).ma, "array member");
+ Assert.AreEqual(23456, ((Struct1)obj).xi, "XmlRpcInt member");
+ Assert.IsTrue(true == ((Struct1)obj).xb);
+ Assert.IsTrue(2345.678 == ((Struct1)obj).xd);
+ Assert.IsTrue(new DateTime(2003, 8, 8, 11, 25, 37).Equals(((Struct1)obj).xdt));
+#if !FX1_0
+ Assert.AreEqual(34567, ((Struct1)obj).nxi, "int? member");
+ Assert.AreEqual(true, ((Struct1)obj).nxb, "bool? member");
+ Assert.AreEqual(3456.789, ((Struct1)obj).nxd, "double? member");
+ Assert.AreEqual(new DateTime(2004, 9, 9, 11, 25, 37), ((Struct1)obj).nxdt, "DateTime? member");
+ Assert.AreEqual(1234, ((ChildStruct)((Struct1)obj).nxstr).x);
+#endif
+ }
+
+ [Test]
+ public void Struct2_AllMissing_ErrorStructIgnore()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><struct></struct></value>";
+ object obj = Utils.Parse(xml, typeof(Struct2), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is Struct2, "obj is Struct2");
+ Assert.AreEqual(0, ((Struct2)obj).mi, "int member");
+ Assert.AreEqual(null, ((Struct2)obj).ms, "string member");
+ Assert.AreEqual(false, ((Struct2)obj).mb,"boolean member");
+ Assert.AreEqual(0.0, ((Struct2)obj).md, "double member");
+ Assert.AreEqual(new DateTime(), ((Struct2)obj).mdt, "dateTime member");
+ Assert.AreEqual(null, ((Struct2)obj).mb64, "base64 member");
+ Assert.AreEqual(null, ((Struct2)obj).ma, "array member");
+ Assert.AreEqual(null, ((Struct2)obj).xi, "XmlRpcInt member");
+ Assert.AreEqual(null, ((Struct2)obj).xb, "XmlRpcBoolean member");
+ Assert.AreEqual(null, ((Struct2)obj).xd, "XmlRpcDouble member");
+ Assert.AreEqual(null, ((Struct2)obj).xdt, "XmlRpcDateTime member");
+ Assert.AreEqual(null, ((Struct2)obj).xstr, "XmlRpcStructTime member");
+#if !FX1_0
+ Assert.AreEqual(null, ((Struct2)obj).nxi, "int? member");
+ Assert.AreEqual(null, ((Struct2)obj).nxb, "bool? member");
+ Assert.AreEqual(null, ((Struct2)obj).nxd, "double? member");
+ Assert.AreEqual(null, ((Struct2)obj).nxdt, "DateTime? member");
+ Assert.AreEqual(null, ((Struct2)obj).nxdt, "ChildStruct? member");
+#endif
+ }
+
+ [Test]
+ public void Struct3_AllMissing_ErrorMemberIgnore()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><struct></struct></value>";
+ object obj = Utils.Parse(xml, typeof(Struct3), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is Struct3, "obj is Struct3");
+ Assert.AreEqual(0, ((Struct3)obj).mi, "int member");
+ Assert.AreEqual(null, ((Struct3)obj).ms, "string member");
+ Assert.AreEqual(false, ((Struct3)obj).mb, "boolean member");
+ Assert.AreEqual(0.0, ((Struct3)obj).md, "double member");
+ Assert.AreEqual(new DateTime(), ((Struct3)obj).mdt, "dateTime member");
+ Assert.AreEqual(null, ((Struct3)obj).mb64, "base64 member");
+ Assert.AreEqual(null, ((Struct3)obj).ma, "array member");
+ Assert.AreEqual(null, ((Struct3)obj).xi, "XmlRpcInt member");
+ Assert.AreEqual(null, ((Struct3)obj).xb, "XmlRpcBoolean member");
+ Assert.AreEqual(null, ((Struct3)obj).xd, "XmlRpcDouble member");
+ Assert.AreEqual(null, ((Struct3)obj).xdt, "XmlRpcDateTime member");
+ Assert.AreEqual(null, ((Struct3)obj).xstr, "XmlRpcStructTime member");
+#if !FX1_0
+ Assert.AreEqual(null, ((Struct3)obj).nxi, "int? member");
+ Assert.AreEqual(null, ((Struct3)obj).nxb, "bool? member");
+ Assert.AreEqual(null, ((Struct3)obj).nxd, "double? member");
+ Assert.AreEqual(null, ((Struct3)obj).nxdt, "DateTime? member");
+ Assert.AreEqual(null, ((Struct3)obj).nxdt, "ChildStruct? member");
+#endif
+ }
+
+ [Test]
+ public void Struct4_AllMissing_ErrorStructErrorMemberIgnore()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><struct></struct></value>";
+ object obj = Utils.Parse(xml, typeof(Struct4), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is Struct4, "obj is Struct4");
+ Assert.AreEqual(0, ((Struct4)obj).mi, "int member");
+ Assert.AreEqual(null, ((Struct4)obj).ms, "string member");
+ Assert.AreEqual(false, ((Struct4)obj).mb, "boolean member");
+ Assert.AreEqual(0.0, ((Struct4)obj).md, "double member");
+ Assert.AreEqual(new DateTime(), ((Struct4)obj).mdt, "dateTime member");
+ Assert.AreEqual(null, ((Struct4)obj).mb64, "base64 member");
+ Assert.AreEqual(null, ((Struct4)obj).ma, "array member");
+ Assert.AreEqual(null, ((Struct4)obj).xi, "XmlRpcInt member");
+ Assert.AreEqual(null, ((Struct4)obj).xb, "XmlRpcBoolean member");
+ Assert.AreEqual(null, ((Struct4)obj).xd, "XmlRpcDouble member");
+ Assert.AreEqual(null, ((Struct4)obj).xdt, "XmlRpcDateTime member");
+ Assert.AreEqual(null, ((Struct4)obj).xstr, "XmlRpcStructTime member");
+#if !FX1_0
+ Assert.AreEqual(null, ((Struct4)obj).nxi, "int? member");
+ Assert.AreEqual(null, ((Struct4)obj).nxb, "bool? member");
+ Assert.AreEqual(null, ((Struct4)obj).nxd, "double? member");
+ Assert.AreEqual(null, ((Struct4)obj).nxdt, "DateTime? member");
+ Assert.AreEqual(null, ((Struct4)obj).nxstr, "ChildStruct? member");
+#endif
+ }
+
+ [Test]
+ public void Struct4_AllMissing_IgnoreStructErrorMemberIgnore()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><struct></struct></value>";
+ object obj = Utils.Parse(xml, typeof(Struct4), MappingAction.Ignore,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is Struct4, "obj is Struct4");
+ Assert.AreEqual(0, ((Struct4)obj).mi,"int member");
+ Assert.AreEqual(null, ((Struct4)obj).ms, "string member");
+ Assert.AreEqual(false, ((Struct4)obj).mb, "boolean member");
+ Assert.AreEqual(0.0, ((Struct4)obj).md, "double member");
+ Assert.AreEqual(new DateTime(), ((Struct4)obj).mdt, "dateTime member");
+ Assert.AreEqual(null, ((Struct4)obj).mb64, "base64 member");
+ Assert.AreEqual(null, ((Struct4)obj).ma, "array member");
+ Assert.AreEqual(null, ((Struct4)obj).xi, "XmlRpcInt member");
+ Assert.AreEqual(null, ((Struct4)obj).xb, "XmlRpcBoolean member");
+ Assert.AreEqual(null, ((Struct4)obj).xd, "XmlRpcDouble member");
+ Assert.AreEqual(null, ((Struct4)obj).xdt, "XmlRpcDateTime member");
+ Assert.AreEqual(null, ((Struct4)obj).xstr, "XmlRpcStructTime member");
+#if !FX1_0
+ Assert.AreEqual(null, ((Struct4)obj).xi, "XmlRpcInt member");
+ Assert.AreEqual(null, ((Struct4)obj).xb, "XmlRpcBoolean member");
+ Assert.AreEqual(null, ((Struct4)obj).xd, "XmlRpcDouble member");
+ Assert.AreEqual(null, ((Struct4)obj).xdt, "XmlRpcDateTime member");
+#endif
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ struct StructOuter1
+ {
+ public StructInner1 mstruct;
+ }
+
+ struct StructInner1
+ {
+ public int mi;
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcTypeMismatchException))]
+ public void NoInnerStructOverrideIgnoreError()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value>
+ <struct>
+ <member>
+ <name>mstruct</name>
+ <value><struct></struct></value>
+ </member>
+ </struct>
+ </value>";
+ object obj = Utils.Parse(xml, typeof(StructOuter1), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.Fail("didn't detect missing members");
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ struct StructOuter2
+ {
+ public StructInner2 mstruct;
+ }
+
+ struct StructInner2
+ {
+ public int mi;
+ }
+
+ [Test]
+ public void NoInnerStructOverrideErrorIgnore()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value>
+ <struct>
+ <member>
+ <name>mstruct</name>
+ <value><struct></struct></value>
+ </member>
+ </struct>
+ </value>";
+ object obj = Utils.Parse(xml, typeof(StructOuter2),
+ MappingAction.Ignore,
+ out parsedType, out parsedArrayType);
+ }
+
+ //-------------------------------------------------------------------------/
+ struct StructHung
+ {
+ int _pi;
+ string _ps;
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int mi;
+ public string ms;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int pi { get { return _pi; } set { _pi = value; } }
+ public string ps { get { return _ps; } set { _ps = value; } }
+ }
+
+ [Test]
+ public void HungStruct()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value>
+ <struct>
+ <member>
+ <name>mi</name>
+ <value><int></int></value>
+ </member>
+ <member>
+ <name>ms</name>
+ <value><string></string></value>
+ </member>
+ <member>
+ <name>ps</name>
+ <value><string>property</string></value>
+ </member>
+ </struct>
+ </value>";
+ object obj = Utils.Parse(xml, typeof(StructHung), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is StructHung);
+ StructHung strct = (StructHung)obj;
+ Assert.AreEqual(strct.mi, 0);
+ Assert.AreEqual(strct.ms, "");
+ Assert.AreEqual(strct.pi, 0);
+ Assert.AreEqual(strct.ps, "property");
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/optionalserializetest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/optionalserializetest.cs
new file mode 100644
index 0000000..a4ad085
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/optionalserializetest.cs
@@ -0,0 +1,444 @@
+using System;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Reflection;
+using System.Threading;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+ [TestFixture]
+ public class OptionalSerializeTest
+ {
+ struct ChildStruct
+ {
+ public int x;
+ public ChildStruct(int num) { x = num; }
+ }
+
+ struct Struct0
+ {
+ public XmlRpcInt xi;
+ public XmlRpcBoolean xb;
+ public XmlRpcDouble xd;
+ public XmlRpcDateTime xdt;
+#if !FX1_0
+ public int? nxi;
+ public bool? nxb;
+ public double? nxd;
+ public DateTime? nxdt;
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ struct Struct1
+ {
+ public int mi;
+ public string ms;
+ public bool mb;
+ public double md;
+ public DateTime mdt;
+ public byte[] mb64;
+ public int[] ma;
+ public XmlRpcInt xi;
+ public XmlRpcBoolean xb;
+ public XmlRpcDouble xd;
+ public XmlRpcDateTime xdt;
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ public int? nxi;
+ public bool? nxb;
+ public double? nxd;
+ public DateTime? nxdt;
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ struct Struct2
+ {
+ public int mi;
+ public string ms;
+ public bool mb;
+ public double md;
+ public DateTime mdt;
+ public byte[] mb64;
+ public int[] ma;
+ public XmlRpcInt xi;
+ public XmlRpcBoolean xb;
+ public XmlRpcDouble xd;
+ public XmlRpcDateTime xdt;
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ public int? nxi;
+ public bool? nxb;
+ public double? nxd;
+ public DateTime? nxdt;
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ struct Struct3
+ {
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public int mi;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public string ms;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public bool mb;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public double md;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public DateTime mdt;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public byte[] mb64;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public int[] ma;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcInt xi;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcBoolean xb;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcDouble xd;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcDateTime xdt;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public int? nxi;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public bool? nxb;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public double? nxd;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public DateTime? nxdt;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ struct Struct4
+ {
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public int mi;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public string ms;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public bool mb;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public double md;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public DateTime mdt;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public byte[] mb64;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public int[] ma;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcInt xi;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcBoolean xb;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcDouble xd;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcDateTime xdt;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public int? nxi;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public bool? nxb;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public double? nxd;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public DateTime? nxdt;
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ struct Struct5
+ {
+ public int mi;
+ public string ms;
+ public bool mb;
+ public double md;
+ public DateTime mdt;
+ public byte[] mb64;
+ public int[] ma;
+ public XmlRpcInt xi;
+ public XmlRpcBoolean xb;
+ public XmlRpcDouble xd;
+ public XmlRpcDateTime xdt;
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ public int? nxi;
+ public bool? nxb;
+ public double? nxd;
+ public DateTime? nxdt;
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ struct Struct6
+ {
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int mi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public string ms;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public bool mb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public double md;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public DateTime mdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public byte[] mb64;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int[] ma;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcInt xi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcBoolean xb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcDouble xd;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcDateTime xdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int? nxi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public bool? nxb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public double? nxd;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public DateTime? nxdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ [XmlRpcMissingMapping(MappingAction.Error)]
+ struct Struct7
+ {
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int mi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public string ms;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public bool mb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public double md;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public DateTime mdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public byte[] mb64;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int[] ma;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcInt xi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcBoolean xb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcDouble xd;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcDateTime xdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcStruct xstr;
+#if !FX1_0
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public int? nxi;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public bool? nxb;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public double? nxd;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public DateTime? nxdt;
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public ChildStruct? nxstr;
+#endif
+ }
+
+ //-------------------------------------------------------------------------/
+ [Test]
+ public void Struct0_AllExist()
+ {
+ Struct0 strout = new Struct0();
+ strout.xi = 1234;
+ strout.xb = true;
+ strout.xd = 1234.567;
+ strout.xdt = new DateTime(2006, 8, 9, 10, 11, 13);
+#if !FX1_0
+ strout.nxi = 5678;
+ strout.nxb = true;
+ strout.nxd = 2345.678;
+ strout.nxdt = new DateTime(2007, 9, 10, 11, 12, 14);
+ strout.nxstr = new ChildStruct(567);
+#endif
+ XmlDocument xdoc = Utils.Serialize("Struct0_AllExist",
+ strout, Encoding.UTF8, MappingAction.Error);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, typeof(Struct0), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsInstanceOfType(typeof(Struct0), obj);
+ Struct0 strin = (Struct0)obj;
+ Assert.AreEqual(strout.xi, strin.xi);
+ Assert.AreEqual(strout.xb, strin.xb);
+ Assert.AreEqual(strout.xd, strin.xd);
+ Assert.AreEqual(strout.xdt, strin.xdt);
+#if !FX1_0
+ Assert.AreEqual(strout.nxi, strin.nxi);
+ Assert.AreEqual(strout.nxb, strin.nxb);
+ Assert.AreEqual(strout.nxd, strin.nxd);
+ Assert.AreEqual(strout.nxdt, strin.nxdt);
+ Assert.AreEqual(((ChildStruct)strout.nxstr).x, ((ChildStruct)strin.nxstr).x);
+#endif
+ }
+
+ //-------------------------------------------------------------------------/
+ [Test]
+ [ExpectedException(typeof(XmlRpcMappingSerializeException))]
+ public void Struct1_AllMissing_ErrorDefault()
+ {
+ XmlDocument xdoc = Utils.Serialize("Struct1_AllMissing_ErrorDefault",
+ new Struct1(),
+ Encoding.UTF8, MappingAction.Error);
+ }
+
+ [Test]
+ public void Struct1_AllMissing_IgnoreDefault()
+ {
+ XmlDocument xdoc = Utils.Serialize("Struct1_AllMissing_IgnoreDefault",
+ new Struct1(),
+ Encoding.UTF8, MappingAction.Ignore);
+ }
+
+ //-------------------------------------------------------------------------/
+ [Test]
+ [ExpectedException(typeof(XmlRpcMappingSerializeException))]
+ public void Struct2_AllMissing_ErrorError()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct2_AllMissing_ErrorError",
+ new Struct2(),
+ Encoding.UTF8, MappingAction.Error);
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcMappingSerializeException))]
+ public void Struct2_AllMissing_IgnoreError()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct2_AllMissing_IgnoreError",
+ new Struct2(),
+ Encoding.UTF8, MappingAction.Ignore);
+ }
+
+ //-------------------------------------------------------------------------/
+ [Test]
+ [ExpectedException(typeof(XmlRpcMappingSerializeException))]
+ public void Struct3_AllMissing_ErrorDefaultError()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct3_AllMissing_ErrorDefaultError",
+ new Struct3(),
+ Encoding.UTF8, MappingAction.Error);
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcMappingSerializeException))]
+ public void Struct3_AllMissing_IgnoreDefaultError()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct3_AllMissing_IgnoreDefaultError",
+ new Struct3(),
+ Encoding.UTF8, MappingAction.Ignore);
+ }
+
+ //-------------------------------------------------------------------------/
+ [Test]
+ [ExpectedException(typeof(XmlRpcMappingSerializeException))]
+ public void Struct4_AllMissing_ErrorIgnoreError()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct4_AllMissing_ErrorIgnoreError",
+ new Struct4(),
+ Encoding.UTF8, MappingAction.Error);
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcMappingSerializeException))]
+ public void Struct4_AllMissing_IgnoreIgnoreError()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct4_AllMissing_IgnoreIgnoreError",
+ new Struct4(),
+ Encoding.UTF8, MappingAction.Ignore);
+ }
+
+ //-------------------------------------------------------------------------/
+ [Test]
+ public void Struct5_AllMissing_ErrorIgnoreDefault()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct5_AllMissing_ErrorIgnoreDefault",
+ new Struct5(),
+ Encoding.UTF8, MappingAction.Error);
+ }
+
+ [Test]
+ public void Struct5_AllMissing_IgnoreIgnoreDefault()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct5_AllMissing_IgnoreIgnoreDefault",
+ new Struct5(),
+ Encoding.UTF8, MappingAction.Ignore);
+ }
+
+ //-------------------------------------------------------------------------/
+ [Test]
+ public void Struct6_AllMissing_ErrorDefaultIgnore()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct6_AllMissing_ErrorDefaultIgnore",
+ new Struct6(),
+ Encoding.UTF8, MappingAction.Error);
+ }
+
+ [Test]
+ public void Struct6_AllMissing_IgnoreDefaultIgnore()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct6_AllMissing_IgnoreDefaultIgnore",
+ new Struct6(),
+ Encoding.UTF8, MappingAction.Ignore);
+ }
+
+ //-------------------------------------------------------------------------/
+ [Test]
+ public void Struct7_AllMissing_ErrorErrorIgnore()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct7_AllMissing_ErrorErrorIgnore",
+ new Struct7(),
+ Encoding.UTF8, MappingAction.Error);
+ }
+
+ [Test]
+ public void Struct7_AllMissing_IgnoreErrorIgnore()
+ {
+ XmlDocument xdoc = Utils.Serialize(
+ "Struct7_AllMissing_IgnoreErrorIgnore",
+ new Struct7(),
+ Encoding.UTF8, MappingAction.Ignore);
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/paramstest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/paramstest.cs
new file mode 100644
index 0000000..87f9dbf
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/paramstest.cs
@@ -0,0 +1,511 @@
+using System;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Reflection;
+using System.Threading;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+namespace ntest
+
+{
+ [TestFixture]
+ public class ParamsTest
+ {
+ public interface IFoo
+ {
+ [XmlRpcMethod]
+ int Foo(params object[] parms);
+ [XmlRpcMethod]
+ int FooNotParams(object[] parms);
+ [XmlRpcMethod]
+ int FooZeroParameters();
+ [XmlRpcMethod]
+ int Bar(params int[] parms);
+ [XmlRpcMethod]
+ int BarNotParams(int[] parms);
+ }
+
+ [Test]
+ public void BuildProxy()
+ {
+ Type newType = XmlRpcProxyGen.Create(typeof(IFoo)).GetType();
+ MethodInfo mi = newType.GetMethod("Foo");
+ ParameterInfo[] pis = mi.GetParameters();
+ Assert.IsTrue(Attribute.IsDefined(pis[pis.Length - 1],
+ typeof(ParamArrayAttribute)), "method has params argument");
+ }
+
+ [Test]
+ public void SerializeObjectNoParams()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { new object[] { 1, "one" } };
+ req.method = "FooNotParams";
+ req.mi = typeof(IFoo).GetMethod("FooNotParams");
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+ Assert.AreEqual(
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>FooNotParams</methodName>
+ <params>
+ <param>
+ <value>
+ <array>
+ <data>
+ <value>
+ <i4>1</i4>
+ </value>
+ <value>
+ <string>one</string>
+ </value>
+ </data>
+ </array>
+ </value>
+ </param>
+ </params>
+</methodCall>", reqstr);
+ }
+
+ [Test]
+ public void SerializeObjectParams()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { new object[] { 1, "one" } };
+ req.method = "Foo";
+ req.mi = typeof(IFoo).GetMethod("Foo");
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+ Assert.AreEqual(
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo</methodName>
+ <params>
+ <param>
+ <value>
+ <i4>1</i4>
+ </value>
+ </param>
+ <param>
+ <value>
+ <string>one</string>
+ </value>
+ </param>
+ </params>
+</methodCall>", reqstr);
+ }
+
+ [Test]
+ public void SerializeIntNoParams()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new object[] { new int[] { 1, 2, 3 } };
+ req.method = "BarNotParams";
+ req.mi = typeof(IFoo).GetMethod("BarNotParams");
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+ Assert.AreEqual(
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>BarNotParams</methodName>
+ <params>
+ <param>
+ <value>
+ <array>
+ <data>
+ <value>
+ <i4>1</i4>
+ </value>
+ <value>
+ <i4>2</i4>
+ </value>
+ <value>
+ <i4>3</i4>
+ </value>
+ </data>
+ </array>
+ </value>
+ </param>
+ </params>
+</methodCall>", reqstr);
+ }
+
+ [Test]
+ public void SerializeIntParams()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { new int[] { 1, 2, 3 } };
+ req.method = "Bar";
+ req.mi = typeof(IFoo).GetMethod("Bar");
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+ Assert.AreEqual(
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Bar</methodName>
+ <params>
+ <param>
+ <value>
+ <i4>1</i4>
+ </value>
+ </param>
+ <param>
+ <value>
+ <i4>2</i4>
+ </value>
+ </param>
+ <param>
+ <value>
+ <i4>3</i4>
+ </value>
+ </param>
+ </params>
+</methodCall>", reqstr);
+ }
+
+ [Test]
+ public void SerializeZeroParameters()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[0];
+ req.method = "FooZeroParameters";
+ req.mi = typeof(IFoo).GetMethod("FooZeroParameters");
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+ Assert.AreEqual(
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>FooZeroParameters</methodName>
+ <params />
+</methodCall>", reqstr);
+ }
+
+
+ [XmlRpcMethod]
+ public int Foo(params object[] args)
+ {
+ return args.Length;
+ }
+
+ [Test]
+ public void DeserializeObjectParams()
+ {
+ string xml =
+@"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo</methodName>
+ <params>
+ <param>
+ <value>
+ <i4>1</i4>
+ </value>
+ </param>
+ <param>
+ <value>
+ <string>one</string>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, this.GetType());
+ Assert.AreEqual(request.method, "Foo", "method is Foo");
+ Assert.AreEqual(request.args[0].GetType(), typeof(object[]),
+ "argument is object[]");
+ Assert.AreEqual((object[])request.args[0], new object[] { 1, "one" },
+ "argument is params array 1, \"one\"");
+ }
+
+ [Test]
+ public void DeserializeParamsEmpty()
+ {
+ string xml =
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo</methodName>
+ <params/>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, this.GetType());
+
+ Assert.AreEqual(request.method, "Foo", "method is Foo");
+ Assert.AreEqual(request.args[0].GetType(), typeof(object[]),
+ "argument is obj[]");
+ Assert.AreEqual((request.args[0] as object[]).Length, 0,
+ "argument is empty array of object");
+ }
+
+ [XmlRpcMethod]
+ public int FooZeroParameters()
+ {
+ return 1;
+ }
+
+ [Test]
+ public void DeserializeZeroParameters()
+ {
+ string xml =
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>FooZeroParameters</methodName>
+ <params />
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr,
+ this.GetType());
+ Assert.AreEqual(request.method, "FooZeroParameters",
+ "method is FooZeroParameters");
+ Assert.AreEqual(0, request.args.Length, "no arguments");
+ }
+
+ [XmlRpcMethod]
+ public int Foo1(int arg1, params object[] args)
+ {
+ return args.Length;
+ }
+
+ [Test]
+ public void DeserializeObjectParams1()
+ {
+ string xml =
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo1</methodName>
+ <params>
+ <param>
+ <value>
+ <i4>5678</i4>
+ </value>
+ </param>
+ <param>
+ <value>
+ <i4>1</i4>
+ </value>
+ </param>
+ <param>
+ <value>
+ <string>one</string>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, this.GetType());
+ Assert.AreEqual(request.method, "Foo1", "method is Foo");
+ Assert.AreEqual((int)request.args[0], 5678, "first argument is int");
+ Assert.AreEqual(request.args[1].GetType(), typeof(object[]),
+ "argument is object[]");
+ Assert.AreEqual((object[])request.args[1], new object[] { 1, "one" },
+ "second argument is params array 1, \"one\"");
+ }
+
+ [XmlRpcMethod]
+ public int Bar(params string[] args)
+ {
+ return args.Length;
+ }
+
+ [Test]
+ public void DeserializeObjectParamsStrings()
+ {
+ string xml =
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Bar</methodName>
+ <params>
+ <param>
+ <value>
+ <string>one</string>
+ </value>
+ </param>
+ <param>
+ <value>
+ <string>two</string>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, this.GetType());
+ Assert.AreEqual(request.method, "Bar", "method is Foo");
+ Assert.AreEqual(request.args[0].GetType(), typeof(string[]),
+ "argument is string[]");
+ Assert.AreEqual((string[])request.args[0], new string[] { "one", "two" },
+ "argument is params array \"one\", \"two\"");
+ }
+
+ [Test]
+ public void DeserializeObjectInvalidParams()
+ {
+ string xml =
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Bar</methodName>
+ <params>
+ <param>
+ <value>
+ <string>string one</string>
+ </value>
+ </param>
+ <param>
+ <value>
+ <i4>2</i4>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+ StringReader sr = new StringReader(xml);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ try
+ {
+ XmlRpcRequest request = serializer.DeserializeRequest(sr,
+ this.GetType());
+ Assert.Fail("Should detect invalid type of parameter #2");
+ }
+ catch(XmlRpcTypeMismatchException)
+ {
+ }
+ }
+
+ [XmlRpcMethod]
+ public int Send_Param(string task, params object[] args)
+ {
+ return args.Length;
+ }
+
+ [Test]
+ public void SerializeMassimo()
+ {
+ object[] param1 = new object[] { "test/Gain1", "Gain", 1, 1,
+ new double[] { 0.5 } };
+ object[] param2 = new object[] { "test/METER", "P1", 1, 1,
+ new double[] { -1.0 } };
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { "IFTASK",
+ new object[] { param1, param2 } };
+ req.method = "Send_Param";
+ req.mi = this.GetType().GetMethod("Send_Param");
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+ Assert.AreEqual(massimoRequest, reqstr);
+ }
+
+ [Test]
+ public void DeserializeMassimo()
+ {
+ StringReader sr = new StringReader(massimoRequest);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest request = serializer.DeserializeRequest(sr, this.GetType());
+ Assert.AreEqual(request.method, "Send_Param", "method is Send_Param");
+ Assert.AreEqual(typeof(string), request.args[0].GetType(),
+ "argument is string");
+ Assert.AreEqual(typeof(object[]), request.args[1].GetType(),
+ "argument is object[]");
+ }
+
+
+ string massimoRequest =
+@"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Send_Param</methodName>
+ <params>
+ <param>
+ <value>
+ <string>IFTASK</string>
+ </value>
+ </param>
+ <param>
+ <value>
+ <array>
+ <data>
+ <value>
+ <string>test/Gain1</string>
+ </value>
+ <value>
+ <string>Gain</string>
+ </value>
+ <value>
+ <i4>1</i4>
+ </value>
+ <value>
+ <i4>1</i4>
+ </value>
+ <value>
+ <array>
+ <data>
+ <value>
+ <double>0.5</double>
+ </value>
+ </data>
+ </array>
+ </value>
+ </data>
+ </array>
+ </value>
+ </param>
+ <param>
+ <value>
+ <array>
+ <data>
+ <value>
+ <string>test/METER</string>
+ </value>
+ <value>
+ <string>P1</string>
+ </value>
+ <value>
+ <i4>1</i4>
+ </value>
+ <value>
+ <i4>1</i4>
+ </value>
+ <value>
+ <array>
+ <data>
+ <value>
+ <double>-1</double>
+ </value>
+ </data>
+ </array>
+ </value>
+ </data>
+ </array>
+ </value>
+ </param>
+ </params>
+</methodCall>";
+ }
+}
+
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/parsetest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/parsetest.cs
new file mode 100644
index 0000000..dddc2f6
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/parsetest.cs
@@ -0,0 +1,720 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Reflection;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+// TODO: parse array
+// TODO: parse struct
+// TODO: parse XmlRpcStruct
+// TODO: parse XmlRpcStruct derived
+// TODO: array of base64
+
+namespace ntest
+{
+ [TestFixture]
+ public class ParseTest
+ {
+ struct Struct2
+ {
+ public int mi;
+ public string ms;
+ public bool mb;
+ public double md;
+ public DateTime mdt;
+ public byte[] mb64;
+ public int[] ma;
+ public XmlRpcInt xi;
+ public XmlRpcBoolean xb;
+ public XmlRpcDouble xd;
+ public XmlRpcDateTime xdt;
+ public XmlRpcStruct xstr;
+ }
+
+ //---------------------- int -------------------------------------------//
+ [Test]
+ public void Int_NullType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><int>12345</int></value>";
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(12345, (int)obj);
+ }
+
+ [Test]
+ public void Int_IntType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><int>12345</int></value>";
+ object obj = Utils.Parse(xml, typeof(int), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(12345, (int)obj);
+ }
+
+ [Test]
+ public void Int_ObjectType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><int>12345</int></value>";
+ object obj = Utils.Parse(xml, typeof(object), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(12345, (int)obj);
+ }
+
+ //---------------------- string ----------------------------------------//
+ [Test]
+ public void String_NullType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><string>astring</string></value>";
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("astring", (string)obj);
+ }
+
+ [Test]
+ public void DefaultString_NullType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value>astring</value>";
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("astring", (string)obj);
+ }
+
+ [Test]
+ public void String_StringType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><string>astring</string></value>";
+ object obj = Utils.Parse(xml, typeof(string), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("astring", (string)obj);
+ }
+
+ [Test]
+ public void String_ObjectType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><string>astring</string></value>";
+ object obj = Utils.Parse(xml, typeof(object), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("astring", (string)obj);
+ }
+
+ [Test]
+ public void DefaultString_StringType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value>astring</value>";
+ object obj = Utils.Parse(xml, typeof(string), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("astring", (string)obj);
+ }
+
+ [Test]
+ public void Empty1String_StringType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><string></string></value>";
+ object obj = Utils.Parse(xml, typeof(string), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("", (string)obj);
+ }
+
+ [Test]
+ public void Empty2String_StringType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><string/></value>";
+ object obj = Utils.Parse(xml, typeof(string), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("", (string)obj);
+ }
+
+ [Test]
+ public void Default1EmptyString_StringType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value></value>";
+ object obj = Utils.Parse(xml, typeof(string), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("", (string)obj);
+ }
+
+ [Test]
+ public void Default2EmptyString_StringType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value/>";
+ object obj = Utils.Parse(xml, typeof(string), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("", (string)obj);
+ }
+
+ //---------------------- boolean ---------------------------------------//
+ [Test]
+ public void Boolean_NullType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><boolean>1</boolean></value>";
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(true, (bool)obj);
+ }
+
+ [Test]
+ public void Boolean_BooleanType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><boolean>1</boolean></value>";
+ object obj = Utils.Parse(xml, typeof(bool), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(true, (bool)obj);
+ }
+
+ [Test]
+ public void Boolean_ObjectType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><boolean>1</boolean></value>";
+ object obj = Utils.Parse(xml, typeof(object), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(true, (bool)obj);
+ }
+
+ //---------------------- double ----------------------------------------//
+ [Test]
+ public void Double_NullType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><double>543.21</double></value>";
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(543.21, (double)obj);
+ }
+
+ [Test]
+ public void Double_DoubleType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><double>543.21</double></value>";
+ object obj = Utils.Parse(xml, typeof(double), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(543.21, (double)obj);
+ }
+
+ [Test]
+ public void Double_ObjectType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><double>543.21</double></value>";
+ object obj = Utils.Parse(xml, typeof(double), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(543.21, (double)obj);
+ }
+
+ //---------------------- dateTime ------------------------------------//
+ [Test]
+ public void DateTime_NullType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>20020706T11:25:37</dateTime.iso8601></value>";
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(new DateTime(2002, 7, 6, 11, 25, 37),
+ (DateTime)obj);
+ }
+
+ [Test]
+ public void DateTime_DateTimeType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>20020706T11:25:37</dateTime.iso8601></value>";
+ object obj = Utils.Parse(xml, typeof(DateTime), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(new DateTime(2002, 7, 6, 11, 25, 37),
+ (DateTime)obj);
+ }
+
+ [Test]
+ public void DateTime_ObjectTimeType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>20020706T11:25:37</dateTime.iso8601></value>";
+ object obj = Utils.Parse(xml, typeof(object), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(new DateTime(2002, 7, 6, 11, 25, 37),
+ (DateTime)obj);
+ }
+
+ [Test]
+ public void DateTime_ROCA()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>2002-07-06T11:25:37</dateTime.iso8601></value>";
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.AllowNonStandardDateTime;
+ object obj = Utils.Parse(xml, typeof(DateTime), MappingAction.Error, serializer,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(new DateTime(2002, 7, 6, 11, 25, 37),
+ (DateTime)obj);
+ }
+
+ [Test]
+ public void DateTime_allZeros1()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>0000-00-00T00:00:00</dateTime.iso8601></value>";
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.MapZerosDateTimeToMinValue;
+ object obj = Utils.Parse(xml, typeof(DateTime), MappingAction.Error, serializer,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(DateTime.MinValue, (DateTime)obj);
+ }
+
+ [Test]
+ public void DateTime_allZeros2()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>0000-00-00T00:00:00Z</dateTime.iso8601></value>";
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.MapZerosDateTimeToMinValue;
+ object obj = Utils.Parse(xml, typeof(DateTime), MappingAction.Error, serializer,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(DateTime.MinValue, (DateTime)obj);
+ }
+
+ [Test]
+ public void DateTime_allZeros3()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>00000000T00:00:00Z</dateTime.iso8601></value>";
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.MapZerosDateTimeToMinValue;
+ object obj = Utils.Parse(xml, typeof(DateTime), MappingAction.Error, serializer,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(DateTime.MinValue, (DateTime)obj);
+ }
+
+ [Test]
+ public void DateTime_allZeros4()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>0000-00-00T00:00:00</dateTime.iso8601></value>";
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.MapZerosDateTimeToMinValue;
+ object obj = Utils.Parse(xml, typeof(DateTime), MappingAction.Error, serializer,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(DateTime.MinValue, (DateTime)obj);
+ }
+
+ [Test]
+ public void DateTime_Empty_Standard()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601></dateTime.iso8601></value>";
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = XmlRpcNonStandard.MapEmptyDateTimeToMinValue;
+ object obj = Utils.Parse(xml, typeof(DateTime), MappingAction.Error, serializer,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(DateTime.MinValue, (DateTime)obj);
+ }
+
+ [Test]
+ [ExpectedException(typeof(XmlRpcInvalidXmlRpcException))]
+ public void DateTime_Empty_NonStandard()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601></dateTime.iso8601></value>";
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ object obj = Utils.Parse(xml, typeof(DateTime), MappingAction.Error, serializer,
+ out parsedType, out parsedArrayType);
+ }
+
+ //---------------------- base64 ----------------------------------------//
+ byte[] testb = new Byte[]
+ {
+ 121, 111, 117, 32, 99, 97, 110, 39, 116, 32, 114, 101, 97, 100,
+ 32, 116, 104, 105, 115, 33 };
+
+ [Test]
+ public void Base64_NullType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><base64>eW91IGNhbid0IHJlYWQgdGhpcyE=</base64></value>";
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is byte[], "result is array of byte");
+ byte[] ret = obj as byte[];
+ Assert.IsTrue(ret.Length == testb.Length);
+ for (int i = 0; i < testb.Length; i++)
+ Assert.IsTrue(testb[i] == ret[i]);
+ }
+
+ [Test]
+ public void Base64_Base64Type()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><base64>eW91IGNhbid0IHJlYWQgdGhpcyE=</base64></value>";
+ object obj = Utils.Parse(xml, typeof(byte[]), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is byte[], "result is array of byte");
+ byte[] ret = obj as byte[];
+ Assert.IsTrue(ret.Length == testb.Length);
+ for (int i = 0; i < testb.Length; i++)
+ Assert.IsTrue(testb[i] == ret[i]);
+ }
+
+ [Test]
+ public void Base64_ObjectType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><base64>eW91IGNhbid0IHJlYWQgdGhpcyE=</base64></value>";
+ object obj = Utils.Parse(xml, typeof(object), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is byte[], "result is array of byte");
+ byte[] ret = obj as byte[];
+ Assert.IsTrue(ret.Length == testb.Length);
+ for (int i = 0; i < testb.Length; i++)
+ Assert.IsTrue(testb[i] == ret[i]);
+ }
+
+ //---------------------- array -----------------------------------------//
+ [Test]
+ public void MixedArray_NullType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+<value>
+ <array>
+ <data>
+ <value><i4>12</i4></value>
+ <value><string>Egypt</string></value>
+ <value><boolean>0</boolean></value>
+ </data>
+ </array>
+</value>";
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is object[], "result is array of object");
+ object[] ret = obj as object[];
+ Assert.AreEqual(12, ret[0]);
+ Assert.AreEqual("Egypt", ret[1]);
+ Assert.AreEqual(false, ret[2]);
+ }
+
+ [Test]
+ public void MixedArray_ObjectArrayType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+<value>
+ <array>
+ <data>
+ <value><i4>12</i4></value>
+ <value><string>Egypt</string></value>
+ <value><boolean>0</boolean></value>
+ </data>
+ </array>
+</value>";
+ object obj = Utils.Parse(xml, typeof(object[]), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is object[], "result is array of object");
+ object[] ret = obj as object[];
+ Assert.AreEqual(12, ret[0]);
+ Assert.AreEqual("Egypt", ret[1]);
+ Assert.AreEqual(false, ret[2]);
+ }
+
+ [Test]
+ public void MixedArray_ObjectType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+<value>
+ <array>
+ <data>
+ <value><i4>12</i4></value>
+ <value><string>Egypt</string></value>
+ <value><boolean>0</boolean></value>
+ </data>
+ </array>
+</value>";
+ object obj = Utils.Parse(xml, typeof(object), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is object[], "result is array of object");
+ object[] ret = obj as object[];
+ Assert.AreEqual(12, ret[0]);
+ Assert.AreEqual("Egypt", ret[1]);
+ Assert.AreEqual(false, ret[2]);
+ }
+
+ [Test]
+ public void HomogArray_NullType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+<value>
+ <array>
+ <data>
+ <value><i4>12</i4></value>
+ <value><i4>13</i4></value>
+ <value><i4>14</i4></value>
+ </data>
+ </array>
+</value>";
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is int[], "result is array of int");
+ int[] ret = obj as int[];
+ Assert.AreEqual(12, ret[0]);
+ Assert.AreEqual(13, ret[1]);
+ Assert.AreEqual(14, ret[2]);
+ }
+
+ [Test]
+ public void HomogArray_IntArrayType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+<value>
+ <array>
+ <data>
+ <value><i4>12</i4></value>
+ <value><i4>13</i4></value>
+ <value><i4>14</i4></value>
+ </data>
+ </array>
+</value>";
+ object obj = Utils.Parse(xml, typeof(int[]), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is int[], "result is array of int");
+ int[] ret = obj as int[];
+ Assert.AreEqual(12, ret[0]);
+ Assert.AreEqual(13, ret[1]);
+ Assert.AreEqual(14, ret[2]);
+ }
+
+ [Test]
+ public void HomogArray_ObjectArrayType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+<value>
+ <array>
+ <data>
+ <value><i4>12</i4></value>
+ <value><i4>13</i4></value>
+ <value><i4>14</i4></value>
+ </data>
+ </array>
+</value>";
+ object obj = Utils.Parse(xml, typeof(object[]), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is object[], "result is array of object");
+ object[] ret = obj as object[];
+ Assert.AreEqual(12, ret[0]);
+ Assert.AreEqual(13, ret[1]);
+ Assert.AreEqual(14, ret[2]);
+ }
+
+ [Test]
+ public void HomogArray_ObjectType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+<value>
+ <array>
+ <data>
+ <value><i4>12</i4></value>
+ <value><i4>13</i4></value>
+ <value><i4>14</i4></value>
+ </data>
+ </array>
+</value>";
+ object obj = Utils.Parse(xml, typeof(object), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is int[], "result is array of int");
+ int[] ret = obj as int[];
+ Assert.AreEqual(12, ret[0]);
+ Assert.AreEqual(13, ret[1]);
+ Assert.AreEqual(14, ret[2]);
+ }
+
+ //---------------------- XmlRpcInt -------------------------------------//
+ [Test]
+ public void XmlRpcInt_XmlRpcIntType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><int>12345</int></value>";
+ object obj = Utils.Parse(xml, typeof(XmlRpcInt), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsInstanceOfType(typeof(XmlRpcInt), obj);
+ Assert.AreEqual(12345, (XmlRpcInt)obj);
+ }
+
+ //---------------------- XmlRpcBoolean ---------------------------------//
+ [Test]
+ public void XmlRpcBoolean_XmlRpcBooleanType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><boolean>1</boolean></value>";
+ object obj = Utils.Parse(xml, typeof(XmlRpcBoolean), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(new XmlRpcBoolean(true), (XmlRpcBoolean)obj);
+ }
+
+ //---------------------- XmlRpcDouble ----------------------------------//
+ [Test]
+ public void XmlRpcDouble_XmlRpcDoubleType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><double>543.21</double></value>";
+ object obj = Utils.Parse(xml, typeof(XmlRpcDouble), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(new XmlRpcDouble(543.21), (XmlRpcDouble)obj);
+ }
+
+ //---------------------- XmlRpcDateTime --------------------------------//
+ [Test]
+ public void XmlRpcDateTime_XmlRpcDateTimeType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>20020706T11:25:37</dateTime.iso8601></value>";
+ object obj = Utils.Parse(xml, typeof(XmlRpcDateTime), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(
+ new XmlRpcDateTime(new DateTime(2002, 7, 6, 11, 25, 37)),
+ (XmlRpcDateTime)obj);
+ }
+
+#if !FX1_0
+ //---------------------- int? -------------------------------------//
+ [Test]
+ public void nullableIntType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?><value><int>12345</int></value>";
+ object obj = Utils.Parse(xml, typeof(int?), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsInstanceOfType(typeof(int?), obj);
+ Assert.AreEqual(12345, obj);
+ }
+
+ //---------------------- bool? ---------------------------------//
+ [Test]
+ public void nullableBoolType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><boolean>1</boolean></value>";
+ object obj = Utils.Parse(xml, typeof(bool?), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(true, obj);
+ }
+
+ //---------------------- double? ----------------------------------//
+ [Test]
+ public void nullableDoubleType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><double>543.21</double></value>";
+ object obj = Utils.Parse(xml, typeof(double?), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(543.21, obj);
+ }
+
+ //---------------------- DateTime? --------------------------------//
+ [Test]
+ public void nullableDateTimeType()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+ <value><dateTime.iso8601>20020706T11:25:37</dateTime.iso8601></value>";
+ object obj = Utils.Parse(xml, typeof(DateTime?), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(new DateTime(2002, 7, 6, 11, 25, 37), obj);
+ }
+#endif
+
+ //---------------------- XmlRpcStruct array ----------------------------//
+ [Test]
+ public void XmlRpcStructArray()
+ {
+ Type parsedType, parsedArrayType;
+ string xml = @"<?xml version=""1.0"" ?>
+<value>
+ <array>
+ <data>
+ <value>
+ <struct>
+ <member>
+ <name>mi</name>
+ <value><i4>18</i4></value>
+ </member>
+ </struct>
+ </value>
+ <value>
+ <struct>
+ <member>
+ <name>mi</name>
+ <value><i4>28</i4></value>
+ </member>
+ </struct>
+ </value>
+ </data>
+ </array>
+</value>";
+
+ object obj = Utils.Parse(xml, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+
+ Assert.AreEqual(obj.GetType(), typeof(object[]));
+ object[] objarray = (object[])obj;
+ Assert.AreEqual(objarray[0].GetType(), typeof(XmlRpcStruct));
+ Assert.AreEqual(objarray[1].GetType(), typeof(XmlRpcStruct));
+ XmlRpcStruct xstruct1 = objarray[0] as XmlRpcStruct;
+ XmlRpcStruct xstruct2 = objarray[1] as XmlRpcStruct;
+
+ Assert.AreEqual(xstruct1["mi"], 18);
+ Assert.AreEqual(xstruct2["mi"], 28);
+ }
+
+
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/proxygentest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/proxygentest.cs
new file mode 100644
index 0000000..856b2a4
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/proxygentest.cs
@@ -0,0 +1,277 @@
+using System;
+using System.Collections;
+using System.IO;
+using System.Net;
+using System.Reflection;
+using System.Threading;
+using System.Security.Cryptography.X509Certificates;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+ [XmlRpcUrl("http://localhost/test/")]
+ public interface ITest
+ {
+ [XmlRpcMethod]
+ string Method1(int x);
+ }
+
+ public interface ITest2 : IXmlRpcProxy
+ {
+ [XmlRpcMethod]
+ string Method1(int x);
+ }
+
+
+ [TestFixture]
+ public class ProxyGenTest
+ {
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ StateNameService.Start(5678);
+ }
+
+ [TestFixtureTearDown]
+ public void TearDown()
+ {
+ StateNameService.Stop();
+ }
+
+ [Test]
+ public void Method1()
+ {
+ ITest proxy = (ITest)XmlRpcProxyGen.Create(typeof(ITest));
+ XmlRpcClientProtocol cp = (XmlRpcClientProtocol)proxy;
+ Assert.IsTrue(cp is ITest);
+ Assert.IsTrue(cp is XmlRpcClientProtocol);
+ }
+
+#if !FX1_0
+ [Test]
+ public void Method1Generic()
+ {
+ ITest2 proxy = XmlRpcProxyGen.Create<ITest2>();
+ XmlRpcClientProtocol cp = (XmlRpcClientProtocol)proxy;
+ Assert.IsTrue(cp is ITest2);
+ Assert.IsTrue(cp is IXmlRpcProxy);
+ Assert.IsTrue(cp is XmlRpcClientProtocol);
+ }
+#endif
+
+ public interface IParent : IXmlRpcProxy
+ {
+ [XmlRpcMethod]
+ string Foo(int x);
+ }
+
+ public interface IChild : IParent
+ {
+ [XmlRpcMethod]
+ string Bar(int x);
+ }
+
+ [Test]
+ public void InheritedInterface()
+ {
+ // Test problem reported by Sean Rohead. This will throw an exception
+ // if method Foo in the base class Parent is not implemented
+ IChild proxy = (IChild)XmlRpcProxyGen.Create(typeof(IChild));
+ }
+
+ [Test]
+ public void ListMethods()
+ {
+ IChild proxy = (IChild)XmlRpcProxyGen.Create(typeof(IChild));
+ }
+
+ [Test]
+ public void CheckProperties()
+ {
+ ITest2 proxy = (ITest2)XmlRpcProxyGen.Create(typeof(ITest2));
+ X509CertificateCollection certs = proxy.ClientCertificates;
+ string groupName = proxy.ConnectionGroupName;
+ bool expect100 = proxy.Expect100Continue;
+ WebHeaderCollection header = proxy.Headers;
+ int indentation = proxy.Indentation;
+ bool keepAlive = proxy.KeepAlive;
+ XmlRpcNonStandard nonStandard = proxy.NonStandard;
+ bool preauth = proxy.PreAuthenticate;
+ Version version = proxy.ProtocolVersion;
+ IWebProxy webProxy = proxy.Proxy;
+ CookieContainer container = proxy.CookieContainer;
+ int timeout = proxy.Timeout;
+ string url = proxy.Url;
+ bool useIndent = proxy.UseIndentation;
+ System.Text.Encoding encoding = proxy.XmlEncoding;
+ string method = proxy.XmlRpcMethod;
+ bool useIntTag = proxy.UseIntTag;
+
+ // introspection methods
+ try { proxy.SystemListMethods(); } catch (XmlRpcMissingUrl) { }
+ try { proxy.SystemMethodSignature("Foo"); } catch (XmlRpcMissingUrl) { }
+ try { proxy.SystemMethodHelp("Foo"); } catch (XmlRpcMissingUrl) { }
+ }
+
+ public interface IOverrides
+ {
+ [XmlRpcMethod("account.info")]
+ string acct_info(int SITECODE, String username);
+ [XmlRpcMethod("account.info")]
+ string acct_info(int SITECODE, int account);
+ }
+
+ public interface IOverridesChild : IOverrides
+ {
+ [XmlRpcMethod("account.info")]
+ new string acct_info(int SITECODE, int account);
+ }
+
+ [Test]
+ public void Overrides()
+ {
+ IOverrides proxy = (IOverrides)XmlRpcProxyGen.Create(typeof(IOverrides));
+ }
+
+ [Test]
+ public void OverridesChild()
+ {
+ IOverridesChild proxy = (IOverridesChild)XmlRpcProxyGen.Create(typeof(IOverridesChild));
+ }
+
+ [Test]
+ public void MakeSynchronousCalls()
+ {
+ IStateName proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));
+ string ret1 = proxy.GetStateName(1);
+ Assert.AreEqual("Alabama", ret1);
+ string ret2 = proxy.GetStateName("1");
+ Assert.AreEqual("Alabama", ret2);
+ }
+
+ [Test]
+ public void SynchronousFaultException()
+ {
+ IStateName proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));
+ try
+ {
+ string ret1 = proxy.GetStateName(100);
+ Assert.Fail("exception not thrown on sync call");
+ }
+ catch (XmlRpcFaultException fex)
+ {
+ Assert.AreEqual(1, fex.FaultCode);
+ Assert.AreEqual("Invalid state number", fex.FaultString);
+ }
+ }
+
+ class CBInfo
+ {
+ public ManualResetEvent _evt;
+ public Exception _excep;
+ public string _ret;
+ public CBInfo(ManualResetEvent evt)
+ {
+ _evt = evt;
+ }
+ }
+
+ void StateNameCallback(IAsyncResult asr)
+ {
+ XmlRpcAsyncResult clientResult = (XmlRpcAsyncResult)asr;
+ IStateName proxy = (IStateName)clientResult.ClientProtocol;
+ CBInfo info = (CBInfo)asr.AsyncState;
+ try
+ {
+ info._ret = proxy.EndGetStateName(asr);
+ }
+ catch (Exception ex)
+ {
+ info._excep = ex;
+ }
+ info._evt.Set();
+ }
+
+ [Test]
+ public void MakeAsynchronousCallIsCompleted()
+ {
+ IStateName proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));
+ IAsyncResult asr1 = proxy.BeginGetStateName(1);
+ while (asr1.IsCompleted == false)
+ System.Threading.Thread.Sleep(10);
+ string ret1 = proxy.EndGetStateName(asr1);
+ Assert.AreEqual("Alabama", ret1);
+ }
+
+ [Test]
+ public void MakeAsynchronousCallWait()
+ {
+ IStateName proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));
+ IAsyncResult asr2 = proxy.BeginGetStateName(1);
+ asr2.AsyncWaitHandle.WaitOne();
+ string ret2 = proxy.EndGetStateName(asr2);
+ Assert.AreEqual("Alabama", ret2);
+ }
+
+ [Test]
+ public void MakeAsynchronousCallCallback()
+ {
+ IStateName proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));
+ ManualResetEvent evt = new ManualResetEvent(false);
+ CBInfo info = new CBInfo(evt);
+ IAsyncResult asr3 = proxy.BeginGetStateName(1, StateNameCallback, info);
+ evt.WaitOne();
+ Assert.AreEqual(null, info._excep, "Async call threw exception");
+ Assert.AreEqual("Alabama", info._ret);
+ }
+
+ void StateNameCallbackNoState(IAsyncResult asr)
+ {
+ XmlRpcAsyncResult clientResult = (XmlRpcAsyncResult)asr;
+ IStateName proxy = (IStateName)clientResult.ClientProtocol;
+ try
+ {
+ _ret = proxy.EndGetStateName(asr);
+ }
+ catch (Exception ex)
+ {
+ _excep = ex;
+ }
+ _evt.Set();
+ }
+
+ ManualResetEvent _evt;
+ Exception _excep;
+ string _ret;
+ [Test]
+ public void MakeAsynchronousCallCallbackNoState()
+ {
+ IStateName proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));
+ _evt = new ManualResetEvent(false);
+ IAsyncResult asr3 = proxy.BeginGetStateName(1, StateNameCallbackNoState);
+ _evt.WaitOne();
+ Assert.AreEqual(null, _excep, "Async call threw exception");
+ Assert.AreEqual("Alabama", _ret);
+ }
+
+ [Test]
+ public void AsynchronousFaultException()
+ {
+ IStateName proxy = (IStateName)XmlRpcProxyGen.Create(typeof(IStateName));
+ IAsyncResult asr = proxy.BeginGetStateName(100);
+ asr.AsyncWaitHandle.WaitOne();
+ try
+ {
+ string ret = proxy.EndGetStateName(asr);
+ Assert.Fail("exception not thrown on async call");
+ }
+ catch (XmlRpcFaultException fex)
+ {
+ Assert.AreEqual(1, fex.FaultCode);
+ Assert.AreEqual("Invalid state number", fex.FaultString);
+ }
+ }
+ }
+}
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/remotingservertest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/remotingservertest.cs
new file mode 100644
index 0000000..94423b0
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/remotingservertest.cs
@@ -0,0 +1,20 @@
+using System;
+using System.IO;
+using System.Reflection;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+
+ [TestFixture]
+ public class RemotingServerTest
+ {
+ [Test]
+ public void Method1()
+ {
+ ITest proxy = (ITest)XmlRpcProxyGen.Create(typeof(ITest));
+ XmlRpcClientProtocol cp = (XmlRpcClientProtocol)proxy;
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serializeresponsetest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serializeresponsetest.cs
new file mode 100644
index 0000000..2393d01
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serializeresponsetest.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Data;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Reflection;
+using System.Threading;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+ [TestFixture]
+ public class SerializeResponseTest
+ {
+ [Test]
+ public void PaoloLiveraniProblem()
+ {
+ try
+ {
+ XmlRpcResponse resp = new XmlRpcResponse(new DataSet());
+ Stream responseStream = new MemoryStream();
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.SerializeResponse(responseStream, resp);
+ }
+ catch(XmlRpcInvalidReturnType ex)
+ {
+ string s = ex.Message;
+ }
+ }
+
+ class FooClass
+ {
+ public void Foo()
+ {
+ Console.WriteLine("Foo called");
+ }
+ }
+
+// [Test]
+// public void VoidReturn()
+// {
+// MethodInfo mi = typeof(FooClass).GetMethod("Foo");
+// FooClass fooInst = new FooClass();
+// object ret = mi.Invoke(fooInst, new object[0]);
+// XmlRpcResponse xmlRpcResp = new XmlRpcResponse(ret);
+// Stream responseStream = new MemoryStream();
+// XmlRpcSerializer serializer = new XmlRpcSerializer();
+// serializer.SerializeResponse(responseStream, xmlRpcResp);
+// responseStream.Seek(0, SeekOrigin.Begin);
+// TextReader trdr = new StreamReader(responseStream);
+// String s = trdr.ReadLine();
+// while (s != null)
+// {
+// Console.WriteLine(s);
+// s = trdr.ReadLine();
+// }
+// responseStream.Seek(0, SeekOrigin.Begin);
+// xmlRpcResp = serializer.DeserializeResponse(responseStream,
+// typeof(string));
+//
+// }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serializetest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serializetest.cs
new file mode 100644
index 0000000..a559f94
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serializetest.cs
@@ -0,0 +1,655 @@
+using System;
+using System.Collections;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Reflection;
+using System.Threading;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+namespace ntest
+
+// TODO: test any culture dependencies
+{
+ [TestFixture]
+ public class SerializeTest
+ {
+ //---------------------- int -------------------------------------------//
+ [Test]
+ public void Int()
+ {
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testInt",
+ 12345,
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(12345, obj);
+ }
+
+ //---------------------- string ----------------------------------------//
+ [Test]
+ public void String()
+ {
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testString",
+ "this is a string",
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual("this is a string", obj);
+ }
+
+ //---------------------- boolean ---------------------------------------//
+ [Test]
+ public void Boolean()
+ {
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testBoolean",
+ true,
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(true, obj);
+ }
+
+ //---------------------- double ----------------------------------------//
+ [Test]
+ public void Double()
+ {
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testDouble",
+ 543.21,
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(543.21, obj);
+ }
+
+ //---------------------- dateTime ------------------------------------//
+ [Test]
+ public void DateTime()
+ {
+ CultureInfo oldci = Thread.CurrentThread.CurrentCulture;
+ try
+ {
+ foreach (string locale in Utils.GetLocales())
+ {
+ CultureInfo ci = new CultureInfo(locale);
+ Thread.CurrentThread.CurrentCulture = ci;
+ DateTime testDate = new DateTime(2002, 7, 6, 11, 25, 37);
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testDateTime",
+ testDate, Encoding.UTF8, MappingAction.Error);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(testDate, obj);
+ }
+ }
+ catch(Exception ex)
+ {
+ Assert.Fail("unexpected exception: " + ex.Message);
+ }
+ finally
+ {
+ Thread.CurrentThread.CurrentCulture = oldci;
+ }
+ }
+
+ [Test]
+ public void DateTimeWarekiCalendar()
+ {
+ CultureInfo oldci = Thread.CurrentThread.CurrentCulture;
+ try
+ {
+ CultureInfo ci = new CultureInfo("ja-JP");
+ Thread.CurrentThread.CurrentCulture = ci;
+ ci.DateTimeFormat.Calendar = new JapaneseCalendar();
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testDateTime",
+ new DateTime(2002, 7, 6, 11, 25, 37),
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(new DateTime(2002, 7, 6, 11, 25, 37), obj);
+ }
+ finally
+ {
+ Thread.CurrentThread.CurrentCulture = oldci;
+ }
+ }
+
+ //---------------------- base64 ----------------------------------------//
+ [Test]
+ public void Base64()
+ {
+ byte[] testb = new Byte[]
+ {
+ 121, 111, 117, 32, 99, 97, 110, 39, 116, 32, 114, 101, 97, 100,
+ 32, 116, 104, 105, 115, 33
+ };
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testBase64",
+ testb,
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is byte[], "result is array of byte");
+ byte[] ret = obj as byte[];
+ Assert.IsTrue(ret.Length == testb.Length);
+ for (int i = 0; i < testb.Length; i++)
+ Assert.IsTrue(testb[i] == ret[i]);
+ }
+
+ //---------------------- array -----------------------------------------//
+ [Test]
+ public void Array()
+ {
+ object[] testary = new Object[] { 12, "Egypt", false };
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testArray",
+ testary,
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is object[], "result is array of object");
+ object[] ret = obj as object[];
+ Assert.AreEqual(12, ret[0]);
+ Assert.AreEqual("Egypt", ret[1]);
+ Assert.AreEqual(false, ret[2]);
+ }
+
+ //---------------------- array -----------------------------------------//
+ [Test]
+ public void MultiDimArray()
+ {
+ int[,] myArray = new int[,] {{1,2}, {3,4}};
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testMultiDimArray",
+ myArray,
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, typeof(int[,]), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is int[,], "result is 2 dim array of int");
+ int[,] ret = obj as int[,];
+ Assert.AreEqual(1, ret[0,0]);
+ Assert.AreEqual(2, ret[0,1]);
+ Assert.AreEqual(3, ret[1,0]);
+ Assert.AreEqual(4, ret[1,1]);
+ }
+
+ //---------------------- struct ----------------------------------------//
+ struct Struct1
+ {
+ public int mi;
+ public string ms;
+ public bool mb;
+ public double md;
+ public DateTime mdt;
+ public byte[] mb64;
+ public int[] ma;
+ public bool Equals(Struct1 str)
+ {
+ if (mi != str.mi || ms != str.ms || md != str.md || mdt != str.mdt)
+ return false;
+ if (mb64.Length != str.mb64.Length)
+ return false;
+ for (int i = 0; i < mb64.Length; i++)
+ if (mb64[i] != str.mb64[i])
+ return false;
+ for (int i = 0; i < ma.Length; i++)
+ if (ma[i] != str.ma[i])
+ return false;
+ return true;
+ }
+ }
+
+ [Test]
+ public void StructTest()
+ {
+ byte[] testb = new Byte[]
+ {
+ 121, 111, 117, 32, 99, 97, 110, 39, 116, 32, 114, 101, 97, 100,
+ 32, 116, 104, 105, 115, 33
+ };
+
+ Struct1 str1 = new Struct1();
+ str1.mi = 34567;
+ str1.ms = "another test string";
+ str1.mb = true;
+ str1.md = 8765.123;
+ str1.mdt = new DateTime(2002, 7, 6, 11, 25, 37);
+ str1.mb64 = testb;
+ str1.ma = new int[] { 1, 2, 3, 4, 5 };
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testStruct",
+ str1,
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, typeof(Struct1), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is Struct1, "result is Struct1");
+ Struct1 str2 = (Struct1)obj;
+ Assert.IsTrue(str2.Equals(str1));
+ }
+
+ struct Struct2
+ {
+ [XmlRpcMember("member_1")]
+ public int member1;
+
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcInt member2;
+
+ [XmlRpcMember("member_3")]
+ [XmlRpcMissingMapping(MappingAction.Ignore)]
+ public XmlRpcInt member3;
+ }
+
+ [Test]
+ public void XmlRpcMember()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { new Struct2() };
+ req.method = "Foo";
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+
+ Assert.AreEqual(
+@"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo</methodName>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>member_1</name>
+ <value>
+ <i4>0</i4>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodCall>", reqstr);
+}
+
+
+
+
+ struct Struct3
+ {
+ int _member1;
+ public int member1 { get { return _member1; } set { _member1 = value; } }
+
+ int _member2;
+ public int member2 { get { return _member2; } }
+
+ int _member3;
+ [XmlRpcMember("member-3")]
+ public int member3 { get { return _member3; } set { _member3 = value; } }
+
+ int _member4;
+ [XmlRpcMember("member-4")]
+ public int member4 { get { return _member4; } }
+ }
+
+ [Test]
+ public void StructProperties()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { new Struct3() };
+ req.method = "Foo";
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+
+ Assert.AreEqual(@"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo</methodName>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>member1</name>
+ <value>
+ <i4>0</i4>
+ </value>
+ </member>
+ <member>
+ <name>member2</name>
+ <value>
+ <i4>0</i4>
+ </value>
+ </member>
+ <member>
+ <name>member-3</name>
+ <value>
+ <i4>0</i4>
+ </value>
+ </member>
+ <member>
+ <name>member-4</name>
+ <value>
+ <i4>0</i4>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodCall>", reqstr);
+ }
+
+
+ public class TestClass
+ {
+ public int _int;
+ public string _string;
+ }
+
+ [Test]
+ public void Class()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ TestClass arg = new TestClass();
+ arg._int = 456;
+ arg._string = "Test Class";
+ req.args = new Object[] { arg };
+ req.method = "Foo";
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+
+ Assert.AreEqual(
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo</methodName>
+ <params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>_int</name>
+ <value>
+ <i4>456</i4>
+ </value>
+ </member>
+ <member>
+ <name>_string</name>
+ <value>
+ <string>Test Class</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+ </params>
+</methodCall>", reqstr);
+ }
+
+ //---------------------- XmlRpcStruct ------------------------------------//
+ [Test]
+ public void XmlRpcStruct()
+ {
+ XmlRpcStruct xmlRpcStruct = new XmlRpcStruct();
+ xmlRpcStruct["mi"] = 34567;
+ xmlRpcStruct["ms"] = "another test string";
+
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testXmlRpcStruct",
+ xmlRpcStruct, Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, typeof(XmlRpcStruct), MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.IsTrue(obj is XmlRpcStruct, "result is XmlRpcStruct");
+ xmlRpcStruct = obj as XmlRpcStruct;
+ Assert.IsTrue(xmlRpcStruct["mi"] is int);
+ Assert.AreEqual((int)xmlRpcStruct["mi"], 34567);
+ Assert.IsTrue(xmlRpcStruct["ms"] is string);
+ Assert.AreEqual((string)xmlRpcStruct["ms"], "another test string");
+ }
+
+ //---------------------- HashTable----------------------------------------//
+ [Test]
+ [ExpectedException(typeof(XmlRpcUnsupportedTypeException))]
+ public void Hashtable()
+ {
+ Hashtable hashtable = new Hashtable();
+ hashtable["mi"] = 34567;
+ hashtable["ms"] = "another test string";
+
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testXmlRpcStruct",
+ hashtable, Encoding.UTF8, MappingAction.Ignore);
+ }
+
+
+ //---------------------- XmlRpcInt -------------------------------------//
+ [Test]
+ public void XmlRpcInt()
+ {
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testXmlRpcInt",
+ new XmlRpcInt(12345),
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(12345, obj);
+ }
+
+ //---------------------- XmlRpcBoolean --------------------------------//
+ [Test]
+ public void XmlRpcBoolean()
+ {
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testXmlRpcBoolean",
+ new XmlRpcBoolean(true),
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(true, obj);
+ }
+
+ //---------------------- XmlRpcDouble ----------------------------------//
+ [Test]
+ public void XmlRpcDouble()
+ {
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testXmlRpcDouble",
+ new XmlRpcDouble(543.21),
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(543.21, obj);
+ }
+
+ [Test]
+ public void XmlRpcDouble_ForeignCulture()
+ {
+ CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
+ XmlDocument xdoc;
+ try
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-BE");
+ XmlRpcDouble xsd = new XmlRpcDouble(543.21);
+ //Console.WriteLine(xsd.ToString());
+ xdoc = Utils.Serialize(
+ "SerializeTest.testXmlRpcDouble_ForeignCulture",
+ new XmlRpcDouble(543.21),
+ Encoding.UTF8, MappingAction.Ignore);
+ }
+ catch(Exception)
+ {
+ throw;
+ }
+ finally
+ {
+ Thread.CurrentThread.CurrentCulture = currentCulture;
+ }
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(543.21, obj);
+ }
+
+ //---------------------- XmlRpcDateTime ------------------------------//
+ [Test]
+ public void XmlRpcDateTime()
+ {
+ XmlDocument xdoc = Utils.Serialize("SerializeTest.testXmlRpcDateTime",
+ new DateTime(2002, 7, 6, 11, 25, 37),
+ Encoding.UTF8, MappingAction.Ignore);
+ Type parsedType, parsedArrayType;
+ object obj = Utils.Parse(xdoc, null, MappingAction.Error,
+ out parsedType, out parsedArrayType);
+ Assert.AreEqual(new DateTime(2002, 7, 6, 11, 25, 37), obj);
+ }
+
+ //---------------------- null parameter ----------------------------------//
+ [Test]
+ [ExpectedException(typeof(XmlRpcNullParameterException))]
+ public void NullParameter()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { null };
+ req.method = "Foo";
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ }
+
+ //---------------------- formatting ----------------------------------//
+ [Test]
+ public void DefaultFormatting()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { 1234567 };
+ req.method = "Foo";
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+
+ Assert.AreEqual(
+@"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo</methodName>
+ <params>
+ <param>
+ <value>
+ <i4>1234567</i4>
+ </value>
+ </param>
+ </params>
+</methodCall>", reqstr);
+ }
+
+ [Test]
+ public void IncreasedIndentation()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { 1234567 };
+ req.method = "Foo";
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.Indentation = 4;
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+
+ Assert.AreEqual(
+ @"<?xml version=""1.0""?>
+<methodCall>
+ <methodName>Foo</methodName>
+ <params>
+ <param>
+ <value>
+ <i4>1234567</i4>
+ </value>
+ </param>
+ </params>
+</methodCall>", reqstr);
+ }
+
+ [Test]
+ public void NoIndentation()
+ {
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { 1234567 };
+ req.method = "Foo";
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.UseIndentation = false;
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+
+ Assert.AreEqual(
+ "<?xml version=\"1.0\"?><methodCall><methodName>Foo</methodName>"+
+ "<params><param><value><i4>1234567</i4></value></param></params>"+
+ "</methodCall>", reqstr);
+ }
+
+ [Test]
+ public void StructOrderTest()
+ {
+ byte[] testb = new Byte[]
+ {
+ 121, 111, 117, 32, 99, 97, 110, 39, 116, 32, 114, 101, 97, 100,
+ 32, 116, 104, 105, 115, 33
+ };
+
+ Struct1 str1 = new Struct1();
+ str1.mi = 34567;
+ str1.ms = "another test string";
+ str1.mb = true;
+ str1.md = 8765.123;
+ str1.mdt = new DateTime(2002, 7, 6, 11, 25, 37);
+ str1.mb64 = testb;
+ str1.ma = new int[] { 1, 2, 3, 4, 5 };
+
+ Stream stm = new MemoryStream();
+ XmlRpcRequest req = new XmlRpcRequest();
+ req.args = new Object[] { str1 };
+ req.method = "Foo";
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.SerializeRequest(stm, req);
+ stm.Position = 0;
+ TextReader tr = new StreamReader(stm);
+ string reqstr = tr.ReadToEnd();
+ Assert.Less(reqstr.IndexOf(">mi</"), reqstr.IndexOf(">ms</"));
+ Assert.Less(reqstr.IndexOf(">ms</"), reqstr.IndexOf(">mb</"));
+ Assert.Less(reqstr.IndexOf(">mb</"), reqstr.IndexOf(">md</"));
+ Assert.Less(reqstr.IndexOf(">md</"), reqstr.IndexOf(">mdt</"));
+ Assert.Less(reqstr.IndexOf(">mdt</"), reqstr.IndexOf(">mb64</"));
+ Assert.Less(reqstr.IndexOf(">mb64</"), reqstr.IndexOf(">ma</"));
+ }
+ }
+}
+
+/*
+"<?xml version=\"1.0\"?>\r\n<methodCall>\r\n <methodName>Foo</methodName>\r\n <params>\r\n <param>\r\n <value>\r\n <struct>\r\n
+ * <member>\r\n <name>mi</name>\r\n <value>\r\n <i4>34567</i4>\r\n </value>\r\n </member>\r\n
+ * <member>\r\n <name>ms</name>\r\n <value>\r\n <string>another test string</string>\r\n </value>\r\n </member>\r\n
+ * <member>\r\n <name>mb</name>\r\n <value>\r\n <boolean>1</boolean>\r\n </value>\r\n </member>\r\n
+ * <member>\r\n <name>md</name>\r\n <value>\r\n <double>8765.123</double>\r\n </value>\r\n </member>\r\n
+ * <member>\r\n <name>mdt</name>\r\n <value>\r\n <dateTime.iso8601>20020706T11:25:37</dateTime.iso8601>\r\n </value>\r\n </member>\r\n
+ * <member>\r\n <name>mb64</name>\r\n <value>\r\n <base64>eW91IGNhbid0IHJlYWQgdGhpcyE=</base64>\r\n </value>\r\n </member>\r\n
+ * <member>\r\n <name>ma</name>\r\n <value>\r\n <array>\r\n <data>\r\n <value>\r\n <i4>1</i4>\r\n </value>\r\n <value>\r\n <i4>2</i4>\r\n </value>\r\n <value>\r\n <i4>3</i4>\r\n </value>\r\n <value>\r\n <i4>4</i4>\r\n </value>\r\n <value>\r\n <i4>5</i4>\r\n </value>\r\n </data>\r\n </array>\r\n </value>\r\n </member>\r\n </struct>\r\n </value>\r\n </param>\r\n </params>\r\n</methodCall>"
+*/ \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serviceinfotest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serviceinfotest.cs
new file mode 100644
index 0000000..7c673fe
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/serviceinfotest.cs
@@ -0,0 +1,313 @@
+using System;
+using System.IO;
+using System.Reflection;
+using NUnit.Framework;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+ [TestFixture]
+ public class ServiceInfoTest
+ {
+ [Test]
+ public void Int32()
+ {
+ Type type = typeof(int);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tInt32, rpcType,
+ "Int32 doesn't map to XmlRpcType.tInt32");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "integer", "Int32 doesn't map to 'integer'");
+ }
+
+ [Test]
+ public void XmlRpcInt()
+ {
+ Type type = typeof(XmlRpcInt);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tInt32, rpcType,
+ "XmlRpcInt doesn't map to XmlRpcType.tInt32");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "integer",
+ "XmlRpcInt doesn't map to 'integer'");
+ }
+
+ [Test]
+ public void Boolean()
+ {
+ Type type = typeof(bool);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tBoolean, rpcType,
+ "Boolean doesn't map to XmlRpcType.tBoolean");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "boolean",
+ "Boolean doesn't map to 'boolean'");
+ }
+
+ [Test]
+ public void XmlRpcBoolean()
+ {
+ Type type = typeof(XmlRpcBoolean);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tBoolean, rpcType,
+ "XmlRpcBoolean doesn't map to XmlRpcType.tBoolean");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "boolean",
+ "XmlRpcBoolean doesn't map to 'boolean'");
+ }
+
+ [Test]
+ public void String()
+ {
+ Type type = typeof(string);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tString, rpcType,
+ "String doesn't map to XmlRpcType.tString");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "string", "String doesn't map to 'string'");
+ }
+
+ [Test]
+ public void Double()
+ {
+ Type type = typeof(double);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tDouble, rpcType,
+ "Double doesn't map to XmlRpcType.tDouble");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "double", "Double doesn't map to 'double'");
+ }
+
+ [Test]
+ public void XmlRpcDouble()
+ {
+ Type type = typeof(XmlRpcDouble);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tDouble, rpcType,
+ "XmlRpcDouble doesn't map to XmlRpcType.tDouble");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "double",
+ "XmlRpcDouble doesn't map to 'double'");
+ }
+
+ [Test]
+ public void DateTime()
+ {
+ Type type = typeof(DateTime);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tDateTime, rpcType,
+ "DateTime doesn't map to XmlRpcType.tDateTime");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "dateTime",
+ "DateTime doesn't map to 'dateTime'");
+ }
+
+ [Test]
+ public void XmlRpcDateTime()
+ {
+ Type type = typeof(XmlRpcDateTime);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tDateTime, rpcType,
+ "XmlRpcDateTime doesn't map to XmlRpcType.tDateTime");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "dateTime",
+ "XmlRpcDateTime doesn't map to 'dateTime'");
+ }
+
+ [Test]
+ public void Base64()
+ {
+ Type type = typeof(byte[]);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tBase64, rpcType,
+ "Byte[] doesn't map to XmlRpcType.tBase64");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "base64", "Byte[] doesn't map to 'base64'");
+ }
+
+ [Test]
+ public void XmlRpcStruct()
+ {
+ Type type = typeof(XmlRpcStruct);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tHashtable, rpcType,
+ "XmlRpcStruct doesn't map to XmlRpcType.tHashtable");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "struct",
+ "XmlRpcStruct doesn't map to 'struct'");
+ }
+
+ [Test]
+ public void Array()
+ {
+ Type type = typeof(Array);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tArray, rpcType,
+ "Array doesn't map to XmlRpcType.tArray");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "array", "Array doesn't map to 'array'");
+ }
+
+ [Test]
+ public void IntArray()
+ {
+ Type type = typeof(Int32[]);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tArray, rpcType,
+ "Int32[] doesn't map to XmlRpcType.tArray");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "array", "Int32[] doesn't map to 'array'");
+ }
+
+ [Test]
+ public void MultiDimIntArray()
+ {
+ Type type = typeof(Int32[,]);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tMultiDimArray, rpcType,
+ "Int32[] doesn't map to XmlRpcType.tMultiDimArray");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "array", "Int32['] doesn't map to 'array'");
+ }
+
+
+ [Test]
+ public void JaggedIntArray()
+ {
+ Type type = typeof(Int32[][]);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tArray, rpcType,
+ "Int32[] doesn't map to XmlRpcType.tArray");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "array", "Int32[] doesn't map to 'array'");
+ }
+
+ [Test]
+ public void Void()
+ {
+ Type type = typeof(void);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tVoid, rpcType,
+ "void doesn't map to XmlRpcType.tVoid");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "void", "void doesn't map to 'void'");
+ }
+
+ struct struct1
+ {
+ public int mi;
+ }
+
+ [Test]
+ public void Struct()
+ {
+ Type type = typeof(struct1);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tStruct, rpcType,
+ "struct doesn't map to XmlRpcType.tStruct");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "struct",
+ "struct doesn't map to 'struct'");
+ }
+
+ enum Fooe
+ {
+ one, two
+ }
+ struct struct2
+ {
+ public int mi;
+ public Fooe mf;
+ }
+
+ [Test]
+ public void StructWithEnum()
+ {
+ Type type = typeof(struct2);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tInvalid, rpcType,
+ "struct doesn't map to XmlRpcType.tInvalid");
+ }
+
+
+ public struct struct3
+ {
+ public int TestProperty { get { return 12345; } }
+ }
+
+ [Test]
+ public void PropertyMember()
+ {
+ XmlRpcServiceInfo info = XmlRpcServiceInfo.CreateServiceInfo(
+ typeof(struct3));
+
+ }
+
+#if !FX1_0
+ [Test]
+ public void NullableInt()
+ {
+ Type type = typeof(int?);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tInt32, rpcType,
+ "int? doesn't map to XmlRpcType.tInt32");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "integer",
+ "int? doesn't map to 'integer'");
+ }
+
+ [Test]
+ public void NullableBool()
+ {
+ Type type = typeof(bool?);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tBoolean, rpcType,
+ "bool? doesn't map to XmlRpcType.tBoolean");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "boolean",
+ "bool? doesn't map to 'boolean'");
+ }
+
+ [Test]
+ public void NullableDouble()
+ {
+ Type type = typeof(double?);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tDouble, rpcType,
+ "double? doesn't map to XmlRpcType.tDouble");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "double",
+ "double? doesn't map to 'double'");
+ }
+
+ [Test]
+ public void NullableDateTime()
+ {
+ Type type = typeof(DateTime?);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tDateTime, rpcType,
+ "DateTime? doesn't map to XmlRpcType.tDateTime");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "dateTime",
+ "DateTime? doesn't map to 'dateTime'");
+ }
+
+ struct TestStruct
+ {
+ public int x;
+ }
+
+ [Test]
+ public void NullableStruct()
+ {
+ Type type = typeof(TestStruct?);
+ XmlRpcType rpcType = XmlRpcServiceInfo.GetXmlRpcType(type);
+ Assert.AreEqual(XmlRpcType.tStruct, rpcType,
+ "TestStruct? doesn't map to XmlRpcType.tStruct");
+ string rpcString = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ Assert.AreEqual(rpcString, "struct",
+ "TestStruct? doesn't map to 'struct'");
+ }
+#endif
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/utils.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/utils.cs
new file mode 100644
index 0000000..2831e9b
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/ntest/utils.cs
@@ -0,0 +1,262 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using System.Xml;
+using CookComputing.XmlRpc;
+
+namespace ntest
+{
+
+ public class Utils
+ {
+ public static XmlDocument Serialize(
+ string testName,
+ object obj,
+ Encoding encoding,
+ MappingAction action)
+ {
+ Stream stm = new MemoryStream();
+ XmlTextWriter xtw = new XmlTextWriter(stm, Encoding.UTF8);
+ xtw.Formatting = Formatting.Indented;
+ xtw.Indentation = 2;
+ xtw.WriteStartDocument();
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.Serialize(xtw, obj, action);
+ xtw.Flush();
+ //Console.WriteLine(testName);
+ stm.Position = 0;
+ TextReader trdr = new StreamReader(stm, new UTF8Encoding(), true, 4096);
+ String s = trdr.ReadLine();
+ while (s != null)
+ {
+ //Console.WriteLine(s);
+ s = trdr.ReadLine();
+ }
+ stm.Position = 0;
+ XmlDocument xdoc = new XmlDocument();
+ xdoc.Load(stm);
+ return xdoc;
+ }
+
+ public static string SerializeToString(
+ string testName,
+ object obj,
+ MappingAction action)
+ {
+ StringWriter strwrtr = new StringWriter();
+ XmlTextWriter xtw = new XmlTextWriter(strwrtr);
+ // xtw.Formatting = formatting;
+ // xtw.Indentation = indentation;
+ xtw.WriteStartDocument();
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ ser.Serialize(xtw, obj, action);
+ xtw.Flush();
+ //Console.WriteLine(testName);
+ //Console.WriteLine(strwrtr.ToString());
+ return strwrtr.ToString();
+ }
+
+ //----------------------------------------------------------------------//
+ public static object Parse(
+ string xml,
+ Type valueType,
+ MappingAction action,
+ out Type parsedType,
+ out Type parsedArrayType)
+ {
+ StringReader sr = new StringReader(xml);
+ XmlDocument xdoc = new XmlDocument();
+ xdoc.Load(sr);
+ return Parse(xdoc, valueType, action,
+ out parsedType, out parsedArrayType);
+ }
+
+ public static object Parse(
+ XmlDocument xdoc,
+ Type valueType,
+ MappingAction action,
+ out Type parsedType,
+ out Type parsedArrayType)
+ {
+ XmlNode node = xdoc.SelectSingleNode("value").FirstChild;
+ XmlRpcSerializer.ParseStack parseStack
+ = new XmlRpcSerializer.ParseStack("request");
+ XmlRpcSerializer ser = new XmlRpcSerializer();
+ object obj = ser.ParseValue(node, valueType, parseStack, action,
+ out parsedType, out parsedArrayType);
+ return obj;
+ }
+
+ public static object Parse(
+ string xml,
+ Type valueType,
+ MappingAction action,
+ XmlRpcSerializer serializer,
+ out Type parsedType,
+ out Type parsedArrayType)
+ {
+ StringReader sr = new StringReader(xml);
+ XmlDocument xdoc = new XmlDocument();
+ xdoc.Load(sr);
+ return Parse(xdoc, valueType, action, serializer,
+ out parsedType, out parsedArrayType);
+ }
+
+ public static object Parse(
+ XmlDocument xdoc,
+ Type valueType,
+ MappingAction action,
+ XmlRpcSerializer serializer,
+ out Type parsedType,
+ out Type parsedArrayType)
+ {
+ XmlNode node = xdoc.SelectSingleNode("value").FirstChild;
+ XmlRpcSerializer.ParseStack parseStack
+ = new XmlRpcSerializer.ParseStack("request");
+ object obj = serializer.ParseValue(node, valueType, parseStack, action,
+ out parsedType, out parsedArrayType);
+ return obj;
+ }
+
+ public static string[] GetLocales()
+ {
+ return new string[]
+ {
+ "af-ZA",
+ "sq-AL",
+ "ar-DZ",
+ "ar-BH",
+ "ar-EG",
+ "ar-IQ",
+ "ar-JO",
+ "ar-KW",
+ "ar-LB",
+ "ar-LY",
+ "ar-MA",
+ "ar-OM",
+ "ar-QA",
+ "ar-SA",
+ "ar-SY",
+ "ar-TN",
+ "ar-AE",
+ "ar-YE",
+ "hy-AM",
+ "az-AZ-Cyrl",
+ "az-AZ-Latn",
+ "eu-ES",
+ "be-BY",
+ "bg-BG",
+ "ca-ES",
+ "zh-HK",
+ "zh-MO",
+ "zh-CN",
+ "zh-SG",
+ "zh-TW",
+ "hr-HR",
+ "cs-CZ",
+ "da-DK",
+ "div-MV",
+ "nl-BE",
+ "nl-NL",
+ "en-AU",
+ "en-BZ",
+ "en-CA",
+ "en-CB",
+ "en-IE",
+ "en-JM",
+ "en-NZ",
+ "en-PH",
+ "en-ZA",
+ "en-TT",
+ "en-GB",
+ "en-US",
+ "en-ZW",
+ "et-EE",
+ "fo-FO",
+ "fa-IR",
+ "fi-FI",
+ "fr-BE",
+ "fr-CA",
+ "fr-FR",
+ "fr-LU",
+ "fr-MC",
+ "fr-CH",
+ "gl-ES",
+ "ka-GE",
+ "de-AT",
+ "de-DE",
+ "de-LI",
+ "de-LU",
+ "de-CH",
+ "el-GR",
+ "gu-IN",
+ "he-IL",
+ "hi-IN",
+ "hu-HU",
+ "is-IS",
+ "id-ID",
+ "it-IT",
+ "it-CH",
+ "ja-JP",
+ "kn-IN",
+ "kk-KZ",
+ "kok-IN",
+ "ko-KR",
+ "lv-LV",
+ "lt-LT",
+ "mk-MK",
+ "ms-BN",
+ "ms-MY",
+ "mr-IN",
+ "mn-MN",
+ "nb-NO",
+ "nn-NO",
+ "pl-PL",
+ "pt-BR",
+ "pt-PT",
+ "pa-IN",
+ "ro-RO",
+ "ru-RU",
+ "sa-IN",
+ "sr-SP-Cyrl",
+ "sr-SP-Latn",
+ "sk-SK",
+ "sl-SI",
+ "es-AR",
+ "es-BO",
+ "es-CL",
+ "es-CO",
+ "es-CR",
+ "es-DO",
+ "es-EC",
+ "es-SV",
+ "es-GT",
+ "es-HN",
+ "es-MX",
+ "es-NI",
+ "es-PA",
+ "es-PY",
+ "es-PE",
+ "es-PR",
+ "es-ES",
+ "es-UY",
+ "es-VE",
+ "sw-KE",
+ "sv-FI",
+ "sv-SE",
+ "syr-SY",
+ "ta-IN",
+ "tt-RU",
+ "te-IN",
+ "th-TH",
+ "tr-TR",
+ "uk-UA",
+ "ur-PK",
+ "uz-UZ-Cyrl",
+ "uz-UZ-Latn",
+ "vi-VN"
+ };
+ }
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyBuildNumber.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyBuildNumber.cs
new file mode 100644
index 0000000..0831137
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyBuildNumber.cs
@@ -0,0 +1,18 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyVersion("2.1.0.3")]
+
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyDesc.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyDesc.cs
new file mode 100644
index 0000000..ae67350
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyDesc.cs
@@ -0,0 +1,31 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Security;
+
+[assembly: AssemblyDescription("Requires .NET 2.0 or later")]
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyDescFX1_0.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyDescFX1_0.cs
new file mode 100644
index 0000000..87f4252
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyDescFX1_0.cs
@@ -0,0 +1,31 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Security;
+
+[assembly: AssemblyDescription("Supports all versions of .NET")]
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyInfo.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyInfo.cs
new file mode 100644
index 0000000..2601ef1
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/AssemblyInfo.cs
@@ -0,0 +1,47 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Security;
+
+[assembly: AssemblyTitle("XML-RPC.NET")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Cook Computing")]
+[assembly: AssemblyProduct("XML-RPC.Net")]
+[assembly: AssemblyCopyright("Charles Cook (c) 2001-2005")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+#if (FX1_0)
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("c:\\Cook Computing\\CookComputing.key")]
+[assembly: AssemblyKeyName("")]
+#endif
+
+#if (!COMPACT_FRAMEWORK)
+[assembly: AllowPartiallyTrustedCallers]
+#endif
+[assembly: System.CLSCompliant(true)]
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/CookComputing.XmlRpc.Targets b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/CookComputing.XmlRpc.Targets
new file mode 100644
index 0000000..d8b37c4
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/CookComputing.XmlRpc.Targets
@@ -0,0 +1,71 @@
+<Project DefaultTargets="Build"
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+ <PropertyGroup>
+ <_DisabledWarnings>$(NoWarn)</_DisabledWarnings>
+ <DefineConstants>$(DefineConstants);FX1_0</DefineConstants>
+ </PropertyGroup>
+
+ <Target
+ Name="CoreCompile"
+ Inputs="$(MSBuildAllProjects);
+ @(Compile);
+ @(ManifestResourceWithNoCulture);
+ $(ApplicationIcon);
+ $(AssemblyOriginatorKeyFile);
+ @(ManifestNonResxWithNoCultureOnDisk);
+ @(ReferencePath);
+ @(CompiledLicenseFile);
+ @(EmbeddedDocumentation);
+ @(CustomAdditionalCompileInputs)"
+ Outputs="@(DocFileItem);
+ @(IntermediateAssembly);
+ $(NonExistentFile);
+ @(CustomAdditionalCompileOutputs)"
+ DependsOnTargets="$(CoreCompileDependsOn)"
+ >
+
+ <Csc
+ AdditionalLibPaths="$(AdditionalLibPaths)"
+ AddModules="@(AddModules)"
+ AllowUnsafeBlocks="$(AllowUnsafeBlocks)"
+ BaseAddress="$(BaseAddress)"
+ CheckForOverflowUnderflow="$(CheckForOverflowUnderflow)"
+ CodePage="$(CodePage)"
+ DebugType="$(DebugType)"
+ DefineConstants="$(DefineConstants)"
+ DelaySign="$(DelaySign)"
+ DisabledWarnings="$(_DisabledWarnings)"
+ DocumentationFile="@(DocFileItem)"
+ EmitDebugInformation="$(DebugSymbols)"
+ FileAlignment="$(FileAlignment)"
+ GenerateFullPaths="$(GenerateFullPaths)"
+ KeyContainer="$(KeyContainerName)"
+ LangVersion="$(LangVersion)"
+ MainEntryPoint="$(StartupObject)"
+ ModuleAssemblyName="$(ModuleAssemblyName)"
+ NoConfig="true"
+ NoLogo="$(NoLogo)"
+ NoStandardLib="$(NoStdLib)"
+ Optimize="$(Optimize)"
+ OutputAssembly="@(IntermediateAssembly)"
+ PdbFile="$(PdbFile)"
+ Platform="$(PlatformTarget)"
+ References="C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Web.dll;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Xml.dll"
+ Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile)"
+ ResponseFiles="$(CompilerResponseFile)"
+ Sources="@(Compile)"
+ TargetType="$(OutputType)"
+ ToolPath="C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705"
+ TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
+ UseHostCompilerIfAvailable="$(UseHostCompilerIfAvailable)"
+ Utf8Output="$(Utf8Output)"
+ WarningLevel="$(WarningLevel)"
+ WarningsAsErrors="$(WarningsAsErrors)"
+ WarningsNotAsErrors="$(WarningsNotAsErrors)"
+ Win32Icon="$(ApplicationIcon)"
+ Win32Resource="$(Win32Resource)"
+ />
+
+ </Target>
+</Project> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/GuidEx.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/GuidEx.cs
new file mode 100644
index 0000000..6a58a1c
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/GuidEx.cs
@@ -0,0 +1,222 @@
+//==========================================================================================
+//
+// OpenNETCF.GuidEx
+// Copyright (C) 2003-2005, OpenNETCF.org
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the OpenNETCF.org Shared Source License.
+//
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the OpenNETCF.org Shared Source License
+// for more details.
+//
+// You should have received a copy of the OpenNETCF.org Shared Source License
+// along with this library; if not, email licensing@opennetcf.org to request a copy.
+//
+// If you wish to contact the OpenNETCF Advisory Board to discuss licensing, please
+// email licensing@opennetcf.org.
+//
+// For general enquiries, email enquiries@opennetcf.org or visit our website at:
+// http://www.opennetcf.org
+//
+// !!! A HUGE thank-you goes out to Casey Chesnut for supplying parts of this code !!!
+// !!! You can contact Casey at http://www.brains-n-brawn.com
+//
+//==========================================================================================
+
+#if(COMPACT_FRAMEWORK)
+
+using System;
+using System.Runtime.InteropServices;
+//using OpenNETCF.Security.Cryptography;
+
+// New for v1.3 - "The Guid to end all Guids" - Peter Foot
+namespace OpenNETCF
+{
+ /// <summary>
+ /// Helper class for generating a globally unique identifier (GUID).
+ /// <para><b>Revised in v1.3</b></para>
+ /// </summary>
+ /// <seealso cref="System.Guid"/>
+ public sealed class GuidEx
+ {
+ private GuidEx(){}
+
+ #region New Guid
+ /// <summary>
+ /// Initializes a new instance of the <see cref="System.Guid"/> class.
+ /// </summary>
+ /// <returns>A new <see cref="System.Guid"/> object.</returns>
+ /// <remarks>On CE.NET 4.1 and higher this method uses the CoCreateGuid API call.
+ /// On CE 3.0 based Pocket PCs it uses the OpenNETCF.Security.Cryptography classes to generate a random Guid.</remarks>
+ public static System.Guid NewGuid()
+ {
+ //cocreateguid supported on CE.NET 4.1 and above (4.0 not supported by .NETCF)
+ if(System.Environment.OSVersion.Version.Major > 3)
+ {
+ return NewOleGuid();
+ }
+ else
+ {
+ //check if target has crypto API support
+// if(OpenNETCF.Security.Cryptography.NativeMethods.Context.IsCryptoApi)
+// {
+// return NewCryptoGuid();
+// }
+// else
+ {
+ //if not use random generator
+ return NewRandomGuid();
+ }
+ }
+ }
+ #endregion
+
+
+ #region Constants
+ // constants that are used in the class
+ private class Const
+ {
+ // guid variant types
+ public enum GuidVariant
+ {
+ ReservedNCS = 0x00,
+ Standard = 0x02,
+ ReservedMicrosoft = 0x06,
+ ReservedFuture = 0x07
+ }
+
+ // guid version types
+ public enum GuidVersion
+ {
+ TimeBased = 0x01,
+ Reserved = 0x02,
+ NameBased = 0x03,
+ Random = 0x04
+ }
+
+ // multiplex variant info
+ public const int VariantByte = 8;
+ public const int VariantByteMask = 0x3f;
+ public const int VariantByteShift = 6;
+
+ // multiplex version info
+ public const int VersionByte = 7;
+ public const int VersionByteMask = 0x0f;
+ public const int VersionByteShift = 4;
+ }
+ #endregion
+
+ #region Crypto
+// /// <summary>
+// /// Create a new Random Guid using Crypto APIs
+// /// </summary>
+// /// <returns></returns>
+// public static System.Guid NewCryptoGuid()
+// {
+// //create guid manually
+// byte[] guidbytes = new byte[16];
+//
+// //use crypto apis to generate random bytes
+// OpenNETCF.Security.Cryptography.RNGCryptoServiceProvider rng = new OpenNETCF.Security.Cryptography.RNGCryptoServiceProvider();
+// rng.GetBytes(guidbytes);
+//
+// //set version etc
+// MakeValidRandomGuid(guidbytes);
+//
+// // create the new System.Guid object
+// return new System.Guid(guidbytes);
+// }
+ #endregion
+
+ #region Random
+ /// <summary>
+ /// Create a new Random Guid (For platforms without Crypto support).
+ /// </summary>
+ /// <returns></returns>
+ public static System.Guid NewRandomGuid()
+ {
+ byte[] guidbytes = new byte[16];
+ (new Random()).NextBytes(guidbytes);
+
+ //set version etc
+ MakeValidRandomGuid(guidbytes);
+
+
+ // create the new System.Guid object
+ return new System.Guid(guidbytes);
+ }
+ #endregion
+
+ #region Helper Methods
+ private static void MakeValidRandomGuid(byte[] guidbytes)
+ {
+ // set the variant
+ guidbytes[Const.VariantByte] &= Const.VariantByteMask;
+ guidbytes[Const.VariantByte] |=
+ ((int)Const.GuidVariant.Standard << Const.VariantByteShift);
+
+ // set the version
+ guidbytes[Const.VersionByte] &= Const.VersionByteMask;
+ guidbytes[Const.VersionByte] |=
+ ((int)Const.GuidVersion.Random << Const.VersionByteShift);
+ }
+ #endregion
+
+ #region Ticks
+ /// <summary>
+ /// Create a new <see cref="Guid"/> only using TickCount and bit shifting.
+ /// </summary>
+ public static System.Guid NewGuidTicks()
+ {
+ // Create a unique GUID
+ long fileTime = DateTime.Now.ToUniversalTime().ToFileTime();
+ UInt32 high32 = (UInt32)(fileTime >> 32)+0x146BF4;
+ int tick = System.Environment.TickCount;
+ byte[] guidBytes = new byte[8];
+
+ // load the byte array with random bits
+ Random rand = new Random((int)fileTime);
+ rand.NextBytes(guidBytes);
+
+ // use tick info in the middle of the array
+ guidBytes[2] = (byte)(tick >> 24);
+ guidBytes[3] = (byte)(tick >> 16);
+ guidBytes[4] = (byte)(tick >> 8);
+ guidBytes[5] = (byte)tick;
+
+ // Construct a Guid with our data
+ System.Guid guid = new System.Guid((int)fileTime, (short)high32, (short)((high32 | 0x10000000) >> 16), guidBytes);
+ return guid;
+ }
+ #endregion
+
+ #region Ole
+ /// <summary>
+ /// Create a new <see cref="Guid"/> using COM APIs
+ /// </summary>
+ /// <returns></returns>
+ /// <remarks>Requires Windows CE.NET 4.1 or higher.</remarks>
+ public static System.Guid NewOleGuid()
+ {
+ System.Guid val = System.Guid.Empty;
+
+ int hresult = 0;
+ hresult = CoCreateGuid(ref val);
+
+ if(hresult != 0)
+ {
+ throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error(), "Error creating new Guid");
+ }
+
+ return val;
+ }
+ [DllImport("ole32.dll", SetLastError=true)]
+ private static extern int CoCreateGuid(ref System.Guid pguid);
+ #endregion
+ }
+
+}
+
+#endif \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpRequest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpRequest.cs
new file mode 100644
index 0000000..40a8bb3
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpRequest.cs
@@ -0,0 +1,38 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.IO;
+
+namespace CookComputing.XmlRpc
+{
+
+ public interface IHttpRequest
+ {
+ Stream InputStream { get; }
+ string HttpMethod { get; }
+ }
+
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpRequestHandler.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpRequestHandler.cs
new file mode 100644
index 0000000..b118291
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpRequestHandler.cs
@@ -0,0 +1,36 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+
+namespace CookComputing.XmlRpc
+{
+
+ public interface IHttpRequestHandler
+ {
+ void HandleHttpRequest(IHttpRequest httpReq, IHttpResponse httpResp);
+ }
+
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpResponse.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpResponse.cs
new file mode 100644
index 0000000..ca77981
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IHttpResponse.cs
@@ -0,0 +1,40 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.IO;
+
+namespace CookComputing.XmlRpc
+{
+ public interface IHttpResponse
+ {
+ string ContentType { get; set; }
+ TextWriter Output { get; }
+ Stream OutputStream { get; }
+ int StatusCode { get; set; }
+ string StatusDescription { get; set; }
+ }
+
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IXmlRpcProxy.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IXmlRpcProxy.cs
new file mode 100644
index 0000000..33f45e2
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/IXmlRpcProxy.cs
@@ -0,0 +1,100 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Net;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+
+namespace CookComputing.XmlRpc
+{
+ public interface IXmlRpcProxy
+ {
+#if (!COMPACT_FRAMEWORK)
+ X509CertificateCollection ClientCertificates { get; }
+#endif
+
+#if (!COMPACT_FRAMEWORK)
+ string ConnectionGroupName { get; set; }
+#endif
+
+#if (!COMPACT_FRAMEWORK)
+ CookieContainer CookieContainer { get; }
+#endif
+
+ [Browsable(false)]
+ ICredentials Credentials { get; set; }
+
+#if (!COMPACT_FRAMEWORK)
+ bool Expect100Continue { get; set; }
+#endif
+
+ [Browsable(false)]
+ WebHeaderCollection Headers { get; }
+
+ Guid Id { get; }
+
+ int Indentation { get; set; }
+
+ bool KeepAlive { get; set; }
+
+ XmlRpcNonStandard NonStandard { get; set; }
+
+ bool PreAuthenticate { get; set; }
+
+ [Browsable(false)]
+ System.Version ProtocolVersion { get; set; }
+
+ [Browsable(false)]
+ IWebProxy Proxy { get; set; }
+
+ int Timeout { get; set; }
+
+ string Url { get; set; }
+
+ bool UseIndentation { get; set; }
+
+ bool UseIntTag { get; set; }
+
+ string UserAgent { get; set; }
+
+ [Browsable(false)]
+ Encoding XmlEncoding { get; set; }
+
+ string XmlRpcMethod { get; set; }
+
+ // introspecton methods
+ string[] SystemListMethods();
+ object[] SystemMethodSignature(string MethodName);
+ string SystemMethodHelp(string MethodName);
+
+ // events
+ event XmlRpcRequestEventHandler RequestEvent;
+ event XmlRpcResponseEventHandler ResponseEvent;
+
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/RequestResponseLogger.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/RequestResponseLogger.cs
new file mode 100644
index 0000000..f596bfc
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/RequestResponseLogger.cs
@@ -0,0 +1,59 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.IO;
+
+namespace CookComputing.XmlRpc
+{
+ public class RequestResponseLogger : XmlRpcLogger
+ {
+ string _directory = ".";
+
+ public string Directory
+ {
+ get { return _directory; }
+ set { _directory = Path.GetDirectoryName(value + "/"); }
+ }
+
+ protected override void OnRequest(object sender, XmlRpcRequestEventArgs e)
+ {
+ string fname = string.Format("{0}/{1}-{2:0000}-request-{3}.xml",
+ _directory, DateTime.Now.Ticks, e.RequestNum, e.ProxyID);
+ FileStream fstm = new FileStream(fname, FileMode.Create);
+ Util.CopyStream(e.RequestStream, fstm);
+ fstm.Close();
+ }
+
+ protected override void OnResponse(object sender, XmlRpcResponseEventArgs e)
+ {
+ string fname = string.Format("{0}/{1}-{2:0000}-response-{3}.xml",
+ _directory, DateTime.Now.Ticks, e.RequestNum, e.ProxyID);
+ FileStream fstm = new FileStream(fname, FileMode.Create);
+ Util.CopyStream(e.ResponseStream, fstm);
+ fstm.Close();
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/Tracer.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/Tracer.cs
new file mode 100644
index 0000000..2b9d0cc
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/Tracer.cs
@@ -0,0 +1,57 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using CookComputing.XmlRpc;
+
+namespace xmlrpc
+{
+ public class Tracer : XmlRpcLogger
+ {
+ protected override void OnRequest(object sender, XmlRpcRequestEventArgs e)
+ {
+ DumpStream(e.RequestStream);
+ }
+
+ protected override void OnResponse(object sender, XmlRpcResponseEventArgs e)
+ {
+ DumpStream(e.ResponseStream);
+ }
+
+ private void DumpStream(Stream stm)
+ {
+ stm.Position = 0;
+ TextReader trdr = new StreamReader(stm);
+ String s = trdr.ReadLine();
+ while (s != null)
+ {
+ Trace.WriteLine(s);
+ s = trdr.ReadLine();
+ }
+ }
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcAsyncResult.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcAsyncResult.cs
new file mode 100644
index 0000000..8597ca5
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcAsyncResult.cs
@@ -0,0 +1,245 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.IO;
+ using System.Net;
+ using System.Reflection;
+ using System.Text;
+ using System.Threading;
+
+ public class XmlRpcAsyncResult : IAsyncResult
+ {
+ // IAsyncResult members
+ public object AsyncState
+ {
+ get { return userAsyncState; }
+ }
+
+ public WaitHandle AsyncWaitHandle
+ {
+ get
+ {
+ bool completed = isCompleted;
+ if (manualResetEvent == null)
+ {
+ lock(this)
+ {
+ if (manualResetEvent == null)
+ manualResetEvent = new ManualResetEvent(completed);
+ }
+ }
+ if (!completed && isCompleted)
+ manualResetEvent.Set();
+ return manualResetEvent;
+ }
+ }
+
+ public bool CompletedSynchronously
+ {
+ get { return completedSynchronously; }
+ set
+ {
+ if (completedSynchronously)
+ completedSynchronously = value;
+ }
+ }
+
+ public bool IsCompleted
+ {
+ get { return isCompleted; }
+ }
+
+ public bool UseIndentation
+ {
+ get { return _useIndentation; }
+ }
+
+ public int Indentation
+ {
+ get { return _indentation; }
+ }
+
+ public bool UseIntTag
+ {
+ get { return _useIntTag; }
+ }
+
+ // public members
+ public void Abort()
+ {
+ if (request != null)
+ request.Abort();
+ }
+
+ public Exception Exception
+ {
+ get { return exception; }
+ }
+
+ public XmlRpcClientProtocol ClientProtocol
+ {
+ get { return clientProtocol; }
+ }
+
+ //internal members
+ internal XmlRpcAsyncResult(
+ XmlRpcClientProtocol ClientProtocol,
+ XmlRpcRequest XmlRpcReq,
+ Encoding XmlEncoding,
+ bool useIndentation,
+ int indentation,
+ bool UseIntTag,
+ WebRequest Request,
+ AsyncCallback UserCallback,
+ object UserAsyncState,
+ int retryNumber)
+ {
+ xmlRpcRequest = XmlRpcReq;
+ clientProtocol = ClientProtocol;
+ request = Request;
+ userAsyncState = UserAsyncState;
+ userCallback = UserCallback;
+ completedSynchronously = true;
+ xmlEncoding = XmlEncoding;
+ _useIndentation = useIndentation;
+ _indentation = indentation;
+ _useIntTag = UseIntTag;
+ }
+
+ internal void Complete(
+ Exception ex)
+ {
+ exception = ex;
+ Complete();
+ }
+
+ internal void Complete()
+ {
+ try
+ {
+ if (responseStream != null)
+ {
+ responseStream.Close();
+ responseStream = null;
+ }
+ if (responseBufferedStream != null)
+ responseBufferedStream.Position = 0;
+ }
+ catch(Exception ex)
+ {
+ if (exception == null)
+ exception = ex;
+ }
+ isCompleted = true;
+ try
+ {
+ if (manualResetEvent != null)
+ manualResetEvent.Set();
+ }
+ catch(Exception ex)
+ {
+ if (exception == null)
+ exception = ex;
+ }
+ if (userCallback != null)
+ userCallback(this);
+ }
+
+ internal WebResponse WaitForResponse()
+ {
+ if (!isCompleted)
+ AsyncWaitHandle.WaitOne();
+ if (exception != null)
+ throw exception;
+ return response;
+ }
+
+ internal bool EndSendCalled
+ {
+ get { return endSendCalled; }
+ set { endSendCalled = value; }
+ }
+
+ internal byte[] Buffer
+ {
+ get { return buffer; }
+ set { buffer = value; }
+ }
+
+ internal WebRequest Request { get { return request; }
+ }
+
+ internal WebResponse Response
+ {
+ get { return response; }
+ set { response = value; }
+ }
+
+ internal Stream ResponseStream
+ {
+ get { return responseStream; }
+ set { responseStream = value; }
+ }
+
+ internal XmlRpcRequest XmlRpcRequest
+ {
+ get { return xmlRpcRequest; }
+ set { xmlRpcRequest = value; }
+ }
+
+ internal Stream ResponseBufferedStream
+ {
+ get { return responseBufferedStream; }
+ set { responseBufferedStream = value; }
+ }
+
+ internal Encoding XmlEncoding
+ {
+ get { return xmlEncoding; }
+ }
+
+ XmlRpcClientProtocol clientProtocol;
+ WebRequest request;
+ AsyncCallback userCallback;
+ object userAsyncState;
+ bool completedSynchronously;
+ bool isCompleted;
+ bool endSendCalled = false;
+ ManualResetEvent manualResetEvent;
+ Exception exception;
+ WebResponse response;
+ Stream responseStream;
+ Stream responseBufferedStream;
+ byte[] buffer;
+ XmlRpcRequest xmlRpcRequest;
+ Encoding xmlEncoding;
+ bool _useIndentation;
+ int _indentation;
+ bool _useIntTag;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcBeginAttribute.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcBeginAttribute.cs
new file mode 100644
index 0000000..8ca12cf
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcBeginAttribute.cs
@@ -0,0 +1,73 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ [AttributeUsage(AttributeTargets.Method)]
+ public class XmlRpcBeginAttribute : Attribute
+ {
+ public XmlRpcBeginAttribute()
+ {
+ }
+
+ public XmlRpcBeginAttribute(string method)
+ {
+ this.method = method;
+ }
+
+ public string Method
+ {
+ get
+ { return method; }
+ }
+
+ public Type ReturnType
+ {
+ get { return returnType; }
+ set { returnType = value; }
+ }
+
+ public bool IntrospectionMethod
+ {
+ get { return introspectionMethod; }
+ set { introspectionMethod = value; }
+ }
+
+ public override string ToString()
+ {
+ string value = "Method : " + method;
+ return value;
+ }
+
+ public string Description = "";
+ public bool Hidden = false;
+ private string method = "";
+ private bool introspectionMethod = false;
+ private Type returnType = null;
+ }
+}
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcBoolean.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcBoolean.cs
new file mode 100644
index 0000000..9bfee4e
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcBoolean.cs
@@ -0,0 +1,89 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcBoolean
+ {
+ private bool _value;
+
+ public XmlRpcBoolean()
+ {
+ }
+
+ public XmlRpcBoolean(bool val)
+ {
+ this._value = val;
+ }
+
+ public override string ToString()
+ {
+ return _value.ToString();
+ }
+
+ public override int GetHashCode()
+ {
+ return _value.GetHashCode();
+ }
+
+ public override bool Equals(
+ object o)
+ {
+ if (o == null || !(o is XmlRpcBoolean))
+ return false;
+ XmlRpcBoolean dbl = o as XmlRpcBoolean;
+ return (dbl._value == _value);
+ }
+
+ public static bool operator ==(
+ XmlRpcBoolean xi,
+ XmlRpcBoolean xj)
+ {
+ if (((object)xi) == null && ((object)xj) == null)
+ return true;
+ else if (((object)xi) == null || ((object)xj) == null)
+ return false;
+ else
+ return xi._value == xj._value;
+ }
+
+ public static bool operator != (
+ XmlRpcBoolean xi,
+ XmlRpcBoolean xj)
+ {
+ return !(xi == xj);
+ }
+
+ public static implicit operator bool (XmlRpcBoolean x)
+ {
+ return x._value;
+ }
+
+ public static implicit operator XmlRpcBoolean(bool x)
+ {
+ return new XmlRpcBoolean(x);
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientFormatterSink.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientFormatterSink.cs
new file mode 100644
index 0000000..c0aca29
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientFormatterSink.cs
@@ -0,0 +1,198 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Messaging;
+
+using CookComputing.XmlRpc;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcClientFormatterSink : IClientChannelSink, IMessageSink
+ {
+ // constructors
+ //
+ public XmlRpcClientFormatterSink(
+ IClientChannelSink NextSink)
+ {
+ m_next = NextSink;
+ }
+
+ // properties
+ //
+ public IClientChannelSink NextChannelSink
+ {
+ get { return m_next; }
+ }
+
+ public IMessageSink NextSink
+ {
+ get { throw new NotSupportedException(); }
+ }
+
+ public IDictionary Properties
+ {
+ get { return null; }
+ }
+
+ // public methods
+ //
+ public IMessageCtrl AsyncProcessMessage(
+ IMessage msg,
+ IMessageSink replySink)
+ {
+ throw new NotSupportedException();
+ }
+
+ public void AsyncProcessRequest(
+ IClientChannelSinkStack sinkStack,
+ IMessage msg,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ throw new Exception("not implemented");
+ }
+
+ public void AsyncProcessResponse(
+ IClientResponseChannelSinkStack sinkStack,
+ object state,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ throw new Exception("not implemented");
+ }
+
+ public Stream GetRequestStream(
+ IMessage msg,
+ ITransportHeaders headers)
+ {
+ return null; // TODO: ???
+ }
+
+ public void ProcessMessage(
+ IMessage msg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ responseHeaders = null;
+ responseStream = null;
+ }
+
+ public IMessage SyncProcessMessage(
+ IMessage msg
+ )
+ {
+ IMethodCallMessage mcm = msg as IMethodCallMessage;
+ try
+ {
+ Stream reqStm = null;
+ ITransportHeaders reqHeaders = null;
+ SerializeMessage(mcm, ref reqHeaders, ref reqStm);
+
+ Stream respStm = null;
+ ITransportHeaders respHeaders = null;
+ m_next.ProcessMessage(msg, reqHeaders, reqStm,
+ out respHeaders, out respStm);
+
+ IMessage imsg = DeserializeMessage(mcm, respHeaders, respStm);
+ return imsg;
+ }
+ catch(Exception ex)
+ {
+ return new ReturnMessage(ex, mcm);
+ }
+ }
+
+ // private methods
+ //
+ void SerializeMessage(
+ IMethodCallMessage mcm,
+ ref ITransportHeaders headers,
+ ref Stream stream)
+ {
+ ITransportHeaders reqHeaders = new TransportHeaders();
+ reqHeaders["__Uri"] = mcm.Uri;
+ reqHeaders["Content-Type"] = "text/xml; charset=\"utf-8\"";
+ reqHeaders["__RequestVerb"] = "POST";
+
+ MethodInfo mi = (MethodInfo) mcm.MethodBase;
+ string methodName = GetRpcMethodName(mi);
+ XmlRpcRequest xmlRpcReq = new XmlRpcRequest(methodName, mcm.InArgs);
+ // TODO: possibly call GetRequestStream from next sink in chain?
+ // TODO: SoapClientFormatter sink uses ChunkedStream - check why?
+ Stream stm = new MemoryStream();
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.SerializeRequest(stm, xmlRpcReq);
+ stm.Position = 0;
+
+ headers = reqHeaders;
+ stream = stm;
+ }
+
+ IMessage DeserializeMessage(
+ IMethodCallMessage mcm,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ object tp = mcm.MethodBase;
+ System.Reflection.MethodInfo mi = (System.Reflection.MethodInfo)tp;
+ System.Type t = mi.ReturnType;
+ XmlRpcResponse xmlRpcResp = serializer.DeserializeResponse(stream, t);
+ IMessage imsg = new ReturnMessage(xmlRpcResp.retVal, null, 0, null, mcm);
+ return imsg;
+ }
+
+ string GetRpcMethodName(MethodInfo mi)
+ {
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcMethodAttribute));
+ // TODO: do methods need attribute?
+ // if (attr == null)
+ // {
+ // throw new Exception("missing method attribute");
+ // }
+ string rpcMethod = "";
+ if (attr != null)
+ {
+ XmlRpcMethodAttribute xrmAttr = attr as XmlRpcMethodAttribute;
+ rpcMethod = xrmAttr.Method;
+ }
+ if (rpcMethod == "")
+ rpcMethod = mi.Name;
+ return rpcMethod;
+ }
+
+ // data
+ //
+ IClientChannelSink m_next;
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientFormatterSinkProvider.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientFormatterSinkProvider.cs
new file mode 100644
index 0000000..2ba78b4
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientFormatterSinkProvider.cs
@@ -0,0 +1,76 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.Collections;
+using System.Runtime.Remoting.Channels;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcClientFormatterSinkProvider : IClientFormatterSinkProvider
+ {
+ // constructors
+ //
+ public XmlRpcClientFormatterSinkProvider(
+ IDictionary properties,
+ ICollection providerData)
+ {
+ // this constructor required when registering via a config file
+ }
+
+ public XmlRpcClientFormatterSinkProvider()
+ {
+ // this constructor used when registering provider programmatically
+ }
+
+ // public methods
+ //
+ public IClientChannelSink CreateSink(
+ IChannelSender channel,
+ string url,
+ object remoteChannelData)
+ {
+ IClientChannelSink ccs = null;
+ if (m_next != null)
+ {
+ ccs = m_next.CreateSink(channel, url, remoteChannelData);
+ if (ccs == null)
+ return null;
+ }
+ return new XmlRpcClientFormatterSink(ccs);
+ }
+
+ public IClientChannelSinkProvider Next
+ {
+ get { return m_next; }
+ set { m_next = value; }
+ }
+
+ // data
+ //
+ IClientChannelSinkProvider m_next;
+ }
+}
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientProtocol.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientProtocol.cs
new file mode 100644
index 0000000..b4177e6
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientProtocol.cs
@@ -0,0 +1,956 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Diagnostics;
+using System.IO;
+using System.Net;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcClientProtocol : Component, IXmlRpcProxy
+ {
+ #region Instance Variables
+#if (!COMPACT_FRAMEWORK)
+ private string _connectionGroupName = null;
+ private bool _expect100Continue = false;
+#endif
+ private ICredentials _credentials = null;
+ private WebHeaderCollection _headers = new WebHeaderCollection();
+ private int _indentation = 2;
+ private bool _keepAlive = true;
+ private XmlRpcNonStandard _nonStandard = XmlRpcNonStandard.None;
+ private bool _preAuthenticate = false;
+ private Version _protocolVersion = HttpVersion.Version11;
+ private IWebProxy _proxy = null;
+ private int _timeout = 100000;
+ private string _url = null;
+ private string _userAgent = "XML-RPC.NET";
+ private bool _useIndentation = true;
+ private bool _useIntTag = false;
+ private Encoding _xmlEncoding = null;
+ private string _xmlRpcMethod = null;
+
+#if (!COMPACT_FRAMEWORK)
+ private X509CertificateCollection _clientCertificates
+ = new X509CertificateCollection();
+ private CookieContainer _cookies = new CookieContainer();
+#endif
+ #endregion
+ private Guid _id = Util.NewGuid();
+
+
+#if (!COMPACT_FRAMEWORK)
+ public XmlRpcClientProtocol(System.ComponentModel.IContainer container)
+ {
+ container.Add(this);
+ InitializeComponent();
+ }
+#endif
+ public XmlRpcClientProtocol()
+ {
+ InitializeComponent();
+ }
+
+ public object Invoke(
+ MethodBase mb,
+ params object[] Parameters)
+ {
+ return Invoke(this, mb as MethodInfo, Parameters);
+ }
+
+ public object Invoke(
+ MethodInfo mi,
+ params object[] Parameters)
+ {
+ return Invoke(this, mi, Parameters);
+ }
+
+ public object Invoke(
+ string MethodName,
+ params object[] Parameters)
+ {
+ return Invoke(this, MethodName, Parameters);
+ }
+
+ public object Invoke(
+ Object clientObj,
+ string methodName,
+ params object[] parameters)
+ {
+ MethodInfo mi = GetMethodInfoFromName(clientObj, methodName, parameters);
+ return Invoke(this, mi, parameters);
+ }
+
+ public object Invoke(
+ Object clientObj,
+ MethodInfo mi,
+ params object[] parameters)
+ {
+ WebRequest webReq = null;
+ object reto = null;
+ try
+ {
+ string useUrl = GetEffectiveUrl(clientObj);
+ webReq = GetWebRequest(new Uri(useUrl));
+ XmlRpcRequest req = MakeXmlRpcRequest(webReq, mi, parameters,
+ clientObj, _xmlRpcMethod, _id);
+ SetProperties(webReq);
+ SetRequestHeaders(_headers, webReq);
+#if (!COMPACT_FRAMEWORK)
+ SetClientCertificates(_clientCertificates, webReq);
+#endif
+ Stream serStream = null;
+ Stream reqStream = null;
+ bool logging = (RequestEvent != null);
+ if (!logging)
+ serStream = reqStream = webReq.GetRequestStream();
+ else
+ serStream = new MemoryStream(2000);
+ try
+ {
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ if (_xmlEncoding != null)
+ serializer.XmlEncoding = _xmlEncoding;
+ serializer.UseIndentation = _useIndentation;
+ serializer.Indentation = _indentation;
+ serializer.NonStandard = _nonStandard;
+ serializer.SerializeRequest(serStream, req);
+ if (logging)
+ {
+ reqStream = webReq.GetRequestStream();
+ serStream.Position = 0;
+ Util.CopyStream(serStream, reqStream);
+ reqStream.Flush();
+ serStream.Position = 0;
+ OnRequest(new XmlRpcRequestEventArgs(req.proxyId, req.number,
+ serStream));
+ }
+ }
+ finally
+ {
+ reqStream.Close();
+ }
+ WebResponse webResp = GetWebResponse(webReq);
+ Stream respStm = null;
+ Stream deserStream;
+ logging = (ResponseEvent != null);
+ try
+ {
+ respStm = webResp.GetResponseStream();
+ if (!logging)
+ {
+ deserStream = respStm;
+ }
+ else
+ {
+ deserStream = new MemoryStream(2000);
+ Util.CopyStream(respStm, deserStream);
+ deserStream.Flush();
+ deserStream.Position = 0;
+ }
+ try
+ {
+ XmlRpcResponse resp = ReadResponse(req, webResp, deserStream, null);
+ reto = resp.retVal;
+ }
+ finally
+ {
+ if (logging)
+ {
+ deserStream.Position = 0;
+ OnResponse(new XmlRpcResponseEventArgs(req.proxyId, req.number,
+ deserStream));
+ }
+ }
+ }
+ finally
+ {
+ if (respStm != null)
+ respStm.Close();
+ }
+ }
+ finally
+ {
+ if (webReq != null)
+ webReq = null;
+ }
+ return reto;
+ }
+
+ #region Properties
+
+#if (!COMPACT_FRAMEWORK)
+ [Browsable(false)]
+ public X509CertificateCollection ClientCertificates
+ {
+ get { return _clientCertificates; }
+ }
+#endif
+
+#if (!COMPACT_FRAMEWORK)
+ public string ConnectionGroupName
+ {
+ get { return _connectionGroupName; }
+ set { _connectionGroupName = value; }
+ }
+#endif
+
+ [Browsable(false)]
+ public ICredentials Credentials
+ {
+ get { return _credentials; }
+ set { _credentials = value; }
+ }
+
+ [Browsable(false)]
+ public WebHeaderCollection Headers
+ {
+ get { return _headers; }
+ }
+
+#if (!COMPACT_FRAMEWORK)
+ public bool Expect100Continue
+ {
+ get { return _expect100Continue; }
+ set { _expect100Continue = value; }
+ }
+
+ public CookieContainer CookieContainer
+ {
+ get { return _cookies; }
+ }
+#endif
+
+ public Guid Id
+ {
+ get { return _id; }
+ }
+
+ public int Indentation
+ {
+ get { return _indentation; }
+ set { _indentation = value; }
+ }
+
+ public bool KeepAlive
+ {
+ get { return _keepAlive; }
+ set { _keepAlive = value; }
+ }
+
+ public XmlRpcNonStandard NonStandard
+ {
+ get { return _nonStandard; }
+ set { _nonStandard = value; }
+ }
+
+ public bool PreAuthenticate
+ {
+ get { return _preAuthenticate; }
+ set { _preAuthenticate = value; }
+ }
+
+ [Browsable(false)]
+ public System.Version ProtocolVersion
+ {
+ get { return _protocolVersion; }
+ set { _protocolVersion = value; }
+ }
+
+ [Browsable(false)]
+ public IWebProxy Proxy
+ {
+ get { return _proxy; }
+ set { _proxy = value; }
+ }
+
+ public int Timeout
+ {
+ get { return _timeout; }
+ set { _timeout = value; }
+ }
+
+ public string Url
+ {
+ get { return _url; }
+ set { _url = value; }
+ }
+
+ public bool UseIndentation
+ {
+ get { return _useIndentation; }
+ set { _useIndentation = value; }
+ }
+
+ public bool UseIntTag
+ {
+ get { return _useIntTag; }
+ set { _useIntTag = value; }
+ }
+
+ public string UserAgent
+ {
+ get { return _userAgent; }
+ set { _userAgent = value; }
+ }
+
+ [Browsable(false)]
+ public Encoding XmlEncoding
+ {
+ get { return _xmlEncoding; }
+ set { _xmlEncoding = value; }
+ }
+
+ public string XmlRpcMethod
+ {
+ get { return _xmlRpcMethod; }
+ set { _xmlRpcMethod = value; }
+ }
+
+ #endregion
+
+ public void SetProperties(WebRequest webReq)
+ {
+ if (_proxy != null)
+ webReq.Proxy = _proxy;
+ HttpWebRequest httpReq = (HttpWebRequest)webReq;
+ httpReq.UserAgent = _userAgent;
+ httpReq.ProtocolVersion = _protocolVersion;
+ httpReq.KeepAlive = _keepAlive;
+#if (!COMPACT_FRAMEWORK)
+ httpReq.CookieContainer = _cookies;
+ httpReq.ServicePoint.Expect100Continue = _expect100Continue;
+#endif
+ webReq.Timeout = Timeout;
+#if (!COMPACT_FRAMEWORK)
+ webReq.ConnectionGroupName = this._connectionGroupName;
+#endif
+ webReq.Credentials = Credentials;
+ webReq.PreAuthenticate = PreAuthenticate;
+ // Compact Framework sets this to false by default
+ (webReq as HttpWebRequest).AllowWriteStreamBuffering = true;
+ }
+
+ private void SetRequestHeaders(
+ WebHeaderCollection headers,
+ WebRequest webReq)
+ {
+ foreach (string key in headers)
+ {
+ webReq.Headers.Add(key, headers[key]);
+ }
+ }
+#if (!COMPACT_FRAMEWORK)
+ private void SetClientCertificates(
+ X509CertificateCollection certificates,
+ WebRequest webReq)
+ {
+ foreach (X509Certificate certificate in certificates)
+ {
+ HttpWebRequest httpReq = (HttpWebRequest)webReq;
+ httpReq.ClientCertificates.Add(certificate);
+ }
+ }
+#endif
+ XmlRpcRequest MakeXmlRpcRequest(WebRequest webReq, MethodInfo mi,
+ object[] parameters, object clientObj, string xmlRpcMethod,
+ Guid proxyId)
+ {
+ webReq.Method = "POST";
+ webReq.ContentType = "text/xml";
+ string rpcMethodName = GetRpcMethodName(clientObj, mi);
+ XmlRpcRequest req = new XmlRpcRequest(rpcMethodName, parameters, mi,
+ xmlRpcMethod, proxyId);
+ return req;
+ }
+
+ XmlRpcResponse ReadResponse(
+ XmlRpcRequest req,
+ WebResponse webResp,
+ Stream respStm,
+ Type returnType)
+ {
+ HttpWebResponse httpResp = (HttpWebResponse)webResp;
+ if (httpResp.StatusCode != HttpStatusCode.OK)
+ {
+ // status 400 is used for errors caused by the client
+ // status 500 is used for server errors (not server application
+ // errors which are returned as fault responses)
+ if (httpResp.StatusCode == HttpStatusCode.BadRequest)
+ throw new XmlRpcException(httpResp.StatusDescription);
+ else
+ throw new XmlRpcServerException(httpResp.StatusDescription);
+ }
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.NonStandard = _nonStandard;
+ Type retType = returnType;
+ if (retType == null)
+ retType = req.mi.ReturnType;
+ XmlRpcResponse xmlRpcResp
+ = serializer.DeserializeResponse(respStm, retType);
+ return xmlRpcResp;
+ }
+
+ MethodInfo GetMethodInfoFromName(object clientObj, string methodName,
+ object[] parameters)
+ {
+ Type[] paramTypes = new Type[0];
+ if (parameters != null)
+ {
+ paramTypes = new Type[parameters.Length];
+ for (int i = 0; i < paramTypes.Length; i++)
+ {
+ if (parameters[i] == null)
+ throw new XmlRpcNullParameterException("Null parameters are invalid");
+ paramTypes[i] = parameters[i].GetType();
+ }
+ }
+ Type type = clientObj.GetType();
+ MethodInfo mi = type.GetMethod(methodName, paramTypes);
+ if (mi == null)
+ {
+ try
+ {
+ mi = type.GetMethod(methodName);
+ }
+ catch (System.Reflection.AmbiguousMatchException)
+ {
+ throw new XmlRpcInvalidParametersException("Method parameters match "
+ + "the signature of more than one method");
+ }
+ if (mi == null)
+ throw new Exception(
+ "Invoke on non-existent or non-public proxy method");
+ else
+ throw new XmlRpcInvalidParametersException("Method parameters do "
+ + "not match signature of any method called " + methodName);
+ }
+ return mi;
+ }
+
+ string GetRpcMethodName(object clientObj, MethodInfo mi)
+ {
+ string rpcMethod;
+ string MethodName = mi.Name;
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcBeginAttribute));
+ if (attr != null)
+ {
+ rpcMethod = ((XmlRpcBeginAttribute)attr).Method;
+ if (rpcMethod == "")
+ {
+ if (!MethodName.StartsWith("Begin") || MethodName.Length <= 5)
+ throw new Exception(String.Format(
+ "method {0} has invalid signature for begin method",
+ MethodName));
+ rpcMethod = MethodName.Substring(5);
+ }
+ return rpcMethod;
+ }
+ // if no XmlRpcBegin attribute, must have XmlRpcMethod attribute
+ attr = Attribute.GetCustomAttribute(mi, typeof(XmlRpcMethodAttribute));
+ if (attr == null)
+ {
+ throw new Exception("missing method attribute");
+ }
+ XmlRpcMethodAttribute xrmAttr = attr as XmlRpcMethodAttribute;
+ rpcMethod = xrmAttr.Method;
+ if (rpcMethod == "")
+ {
+ rpcMethod = mi.Name;
+ }
+ return rpcMethod;
+ }
+
+ public IAsyncResult BeginInvoke(
+ MethodBase mb,
+ object[] parameters,
+ AsyncCallback callback,
+ object outerAsyncState)
+ {
+ return BeginInvoke(mb as MethodInfo, parameters, this, callback,
+ outerAsyncState);
+ }
+
+ public IAsyncResult BeginInvoke(
+ MethodInfo mi,
+ object[] parameters,
+ AsyncCallback callback,
+ object outerAsyncState)
+ {
+ return BeginInvoke(mi, parameters, this, callback,
+ outerAsyncState);
+ }
+
+ public IAsyncResult BeginInvoke(
+ string methodName,
+ object[] parameters,
+ object clientObj,
+ AsyncCallback callback,
+ object outerAsyncState)
+ {
+ MethodInfo mi = GetMethodInfoFromName(clientObj, methodName, parameters);
+ return BeginInvoke(mi, parameters, this, callback,
+ outerAsyncState);
+ }
+
+ public IAsyncResult BeginInvoke(
+ MethodInfo mi,
+ object[] parameters,
+ object clientObj,
+ AsyncCallback callback,
+ object outerAsyncState)
+ {
+ string useUrl = GetEffectiveUrl(clientObj);
+ WebRequest webReq = GetWebRequest(new Uri(useUrl));
+ XmlRpcRequest xmlRpcReq = MakeXmlRpcRequest(webReq, mi,
+ parameters, clientObj, _xmlRpcMethod, _id);
+ SetProperties(webReq);
+ SetRequestHeaders(_headers, webReq);
+#if (!COMPACT_FRAMEWORK)
+ SetClientCertificates(_clientCertificates, webReq);
+#endif
+ Encoding useEncoding = null;
+ if (_xmlEncoding != null)
+ useEncoding = _xmlEncoding;
+ XmlRpcAsyncResult asr = new XmlRpcAsyncResult(this, xmlRpcReq,
+ useEncoding, _useIndentation, _indentation, _useIntTag, webReq, callback,
+ outerAsyncState, 0);
+ webReq.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback),
+ asr);
+ if (!asr.IsCompleted)
+ asr.CompletedSynchronously = false;
+ return asr;
+ }
+
+ static void GetRequestStreamCallback(IAsyncResult asyncResult)
+ {
+ XmlRpcAsyncResult clientResult
+ = (XmlRpcAsyncResult)asyncResult.AsyncState;
+ clientResult.CompletedSynchronously = asyncResult.CompletedSynchronously;
+ try
+ {
+ Stream serStream = null;
+ Stream reqStream = null;
+ bool logging = (clientResult.ClientProtocol.RequestEvent != null);
+ if (!logging)
+ {
+ serStream = reqStream
+ = clientResult.Request.EndGetRequestStream(asyncResult);
+ }
+ else
+ serStream = new MemoryStream(2000);
+ try
+ {
+ XmlRpcRequest req = clientResult.XmlRpcRequest;
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ if (clientResult.XmlEncoding != null)
+ serializer.XmlEncoding = clientResult.XmlEncoding;
+ serializer.UseIndentation = clientResult.UseIndentation;
+ serializer.Indentation = clientResult.Indentation;
+ serializer.UseIntTag = clientResult.UseIntTag;
+ serializer.SerializeRequest(serStream, req);
+ if (logging)
+ {
+ reqStream = clientResult.Request.EndGetRequestStream(asyncResult);
+ serStream.Position = 0;
+ Util.CopyStream(serStream, reqStream);
+ reqStream.Flush();
+ serStream.Position = 0;
+ clientResult.ClientProtocol.OnRequest(
+ new XmlRpcRequestEventArgs(req.proxyId, req.number, serStream));
+ }
+ }
+ finally
+ {
+ reqStream.Close();
+ }
+ clientResult.Request.BeginGetResponse(
+ new AsyncCallback(GetResponseCallback), clientResult);
+ }
+ catch (Exception ex)
+ {
+ ProcessAsyncException(clientResult, ex);
+ }
+ }
+
+ static void GetResponseCallback(IAsyncResult asyncResult)
+ {
+ XmlRpcAsyncResult result = (XmlRpcAsyncResult)asyncResult.AsyncState;
+ result.CompletedSynchronously = asyncResult.CompletedSynchronously;
+ try
+ {
+ result.Response = result.ClientProtocol.GetWebResponse(result.Request,
+ asyncResult);
+ }
+ catch (Exception ex)
+ {
+ ProcessAsyncException(result, ex);
+ if (result.Response == null)
+ return;
+ }
+ ReadAsyncResponse(result);
+ }
+
+ static void ReadAsyncResponse(XmlRpcAsyncResult result)
+ {
+ if (result.Response.ContentLength == 0)
+ {
+ result.Complete();
+ return;
+ }
+ try
+ {
+ result.ResponseStream = result.Response.GetResponseStream();
+ ReadAsyncResponseStream(result);
+ }
+ catch (Exception ex)
+ {
+ ProcessAsyncException(result, ex);
+ }
+ }
+
+ static void ReadAsyncResponseStream(XmlRpcAsyncResult result)
+ {
+ IAsyncResult asyncResult;
+ do
+ {
+ byte[] buff = result.Buffer;
+ long contLen = result.Response.ContentLength;
+ if (buff == null)
+ {
+ if (contLen == -1)
+ result.Buffer = new Byte[1024];
+ else
+ result.Buffer = new Byte[contLen];
+ }
+ else
+ {
+ if (contLen != -1 && contLen > result.Buffer.Length)
+ result.Buffer = new Byte[contLen];
+ }
+ buff = result.Buffer;
+ asyncResult = result.ResponseStream.BeginRead(buff, 0, buff.Length,
+ new AsyncCallback(ReadResponseCallback), result);
+ if (!asyncResult.CompletedSynchronously)
+ return;
+ }
+ while (!(ProcessAsyncResponseStreamResult(result, asyncResult)));
+ }
+
+ static bool ProcessAsyncResponseStreamResult(XmlRpcAsyncResult result,
+ IAsyncResult asyncResult)
+ {
+ int endReadLen = result.ResponseStream.EndRead(asyncResult);
+ long contLen = result.Response.ContentLength;
+ bool completed;
+ if (endReadLen == 0)
+ completed = true;
+ else if (contLen > 0 && endReadLen == contLen)
+ {
+ result.ResponseBufferedStream = new MemoryStream(result.Buffer);
+ completed = true;
+ }
+ else
+ {
+ if (result.ResponseBufferedStream == null)
+ {
+ result.ResponseBufferedStream = new MemoryStream(result.Buffer.Length);
+ }
+ result.ResponseBufferedStream.Write(result.Buffer, 0, endReadLen);
+ completed = false;
+ }
+ if (completed)
+ result.Complete();
+ return completed;
+ }
+
+
+ static void ReadResponseCallback(IAsyncResult asyncResult)
+ {
+ XmlRpcAsyncResult result = (XmlRpcAsyncResult)asyncResult.AsyncState;
+ result.CompletedSynchronously = asyncResult.CompletedSynchronously;
+ if (asyncResult.CompletedSynchronously)
+ return;
+ try
+ {
+ bool completed = ProcessAsyncResponseStreamResult(result, asyncResult);
+ if (!completed)
+ ReadAsyncResponseStream(result);
+ }
+ catch (Exception ex)
+ {
+ ProcessAsyncException(result, ex);
+ }
+ }
+
+ static void ProcessAsyncException(XmlRpcAsyncResult clientResult,
+ Exception ex)
+ {
+ WebException webex = ex as WebException;
+ if (webex != null && webex.Response != null)
+ {
+ clientResult.Response = webex.Response;
+ return;
+ }
+ if (clientResult.IsCompleted)
+ throw new Exception("error during async processing");
+ clientResult.Complete(ex);
+ }
+
+ public object EndInvoke(
+ IAsyncResult asr)
+ {
+ return EndInvoke(asr, null);
+ }
+
+ public object EndInvoke(
+ IAsyncResult asr,
+ Type returnType)
+ {
+ object reto = null;
+ WebResponse webResp = null;
+ Stream responseStream = null;
+ try
+ {
+ XmlRpcAsyncResult clientResult = (XmlRpcAsyncResult)asr;
+ if (clientResult.Exception != null)
+ throw clientResult.Exception;
+ if (clientResult.EndSendCalled)
+ throw new Exception("dup call to EndSend");
+ clientResult.EndSendCalled = true;
+ webResp = clientResult.WaitForResponse();
+ responseStream = clientResult.ResponseBufferedStream;
+ if (ResponseEvent != null)
+ {
+ OnResponse(new XmlRpcResponseEventArgs(
+ clientResult.XmlRpcRequest.proxyId,
+ clientResult.XmlRpcRequest.number,
+ responseStream));
+ responseStream.Position = 0;
+ }
+ XmlRpcResponse resp = ReadResponse(clientResult.XmlRpcRequest,
+ webResp, responseStream, returnType);
+ reto = resp.retVal;
+ }
+ finally
+ {
+ if (responseStream != null)
+ responseStream.Close();
+ if (webResp != null)
+ webResp = null;
+ }
+ return reto;
+ }
+
+ string GetEffectiveUrl(object clientObj)
+ {
+ Type type = clientObj.GetType();
+ // client can either have define URI in attribute or have set it
+ // via proxy's ServiceURI property - but must exist by now
+ string useUrl = "";
+ if (Url == "" || Url == null)
+ {
+ Attribute urlAttr = Attribute.GetCustomAttribute(type,
+ typeof(XmlRpcUrlAttribute));
+ if (urlAttr != null)
+ {
+ XmlRpcUrlAttribute xrsAttr = urlAttr as XmlRpcUrlAttribute;
+ useUrl = xrsAttr.Uri;
+ }
+ }
+ else
+ {
+ useUrl = Url;
+ }
+ if (useUrl == "")
+ {
+ throw new XmlRpcMissingUrl("Proxy XmlRpcUrl attribute or Url "
+ + "property not set.");
+ }
+ return useUrl;
+ }
+
+ #region Introspection Methods
+ [XmlRpcMethod("system.listMethods")]
+ public string[] SystemListMethods()
+ {
+ return (string[])Invoke("SystemListMethods", new Object[0]);
+ }
+
+ [XmlRpcMethod("system.listMethods")]
+ public IAsyncResult BeginSystemListMethods(
+ AsyncCallback Callback,
+ object State)
+ {
+ return BeginInvoke("SystemListMethods", new object[0], this, Callback,
+ State);
+ }
+
+ public string[] EndSystemListMethods(IAsyncResult AsyncResult)
+ {
+ return (string[])EndInvoke(AsyncResult);
+ }
+
+ [XmlRpcMethod("system.methodSignature")]
+ public object[] SystemMethodSignature(string MethodName)
+ {
+ return (object[])Invoke("SystemMethodSignature",
+ new Object[] { MethodName });
+ }
+
+ [XmlRpcMethod("system.methodSignature")]
+ public IAsyncResult BeginSystemMethodSignature(
+ string MethodName,
+ AsyncCallback Callback,
+ object State)
+ {
+ return BeginInvoke("SystemMethodSignature",
+ new Object[] { MethodName }, this, Callback, State);
+ }
+
+ public Array EndSystemMethodSignature(IAsyncResult AsyncResult)
+ {
+ return (Array)EndInvoke(AsyncResult);
+ }
+
+ [XmlRpcMethod("system.methodHelp")]
+ public string SystemMethodHelp(string MethodName)
+ {
+ return (string)Invoke("SystemMethodHelp",
+ new Object[] { MethodName });
+ }
+
+ [XmlRpcMethod("system.methodHelp")]
+ public IAsyncResult BeginSystemMethodHelp(
+ string MethodName,
+ AsyncCallback Callback,
+ object State)
+ {
+ return BeginInvoke("SystemMethodHelp",
+ new Object[] { MethodName }, this, Callback, State);
+ }
+
+ public string EndSystemMethodHelp(IAsyncResult AsyncResult)
+ {
+ return (string)EndInvoke(AsyncResult);
+ }
+ #endregion
+
+ #region Component Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ }
+ #endregion
+
+ protected virtual WebRequest GetWebRequest(Uri uri)
+ {
+ WebRequest req = WebRequest.Create(uri);
+ return req;
+ }
+
+ protected virtual WebResponse GetWebResponse(WebRequest request)
+ {
+ WebResponse ret = null;
+ try
+ {
+ ret = request.GetResponse();
+ }
+ catch (WebException ex)
+ {
+ if (ex.Response == null)
+ throw;
+ ret = ex.Response;
+ }
+ return ret;
+ }
+
+ protected virtual WebResponse GetWebResponse(WebRequest request,
+ IAsyncResult result)
+ {
+ return request.EndGetResponse(result);
+ }
+
+ public event XmlRpcRequestEventHandler RequestEvent;
+ public event XmlRpcResponseEventHandler ResponseEvent;
+
+
+ protected virtual void OnRequest(XmlRpcRequestEventArgs e)
+ {
+ if (RequestEvent != null)
+ {
+ RequestEvent(this, e);
+ }
+ }
+
+ internal bool LogResponse
+ {
+ get { return ResponseEvent != null; }
+ }
+
+ protected virtual void OnResponse(XmlRpcResponseEventArgs e)
+ {
+ if (ResponseEvent != null)
+ {
+ ResponseEvent(this, e);
+ }
+ }
+
+ internal void InternalOnResponse(XmlRpcResponseEventArgs e)
+ {
+ OnResponse(e);
+ }
+ }
+
+#if (COMPACT_FRAMEWORK)
+ // dummy attribute because System.ComponentModel.Browsable is not
+ // support in the compact framework
+ [AttributeUsage(AttributeTargets.Property)]
+ public class BrowsableAttribute : Attribute
+ {
+ public BrowsableAttribute(bool dummy)
+ {
+ }
+ }
+#endif
+
+ public delegate void XmlRpcRequestEventHandler(object sender,
+ XmlRpcRequestEventArgs args);
+
+ public delegate void XmlRpcResponseEventHandler(object sender,
+ XmlRpcResponseEventArgs args);
+}
+
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientProtocol.resx b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientProtocol.resx
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcClientProtocol.resx
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDateTime.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDateTime.cs
new file mode 100644
index 0000000..642342a
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDateTime.cs
@@ -0,0 +1,92 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ public class XmlRpcDateTime
+ {
+ private DateTime _value;
+
+ public XmlRpcDateTime()
+ {
+ this._value = new DateTime();
+ }
+
+ public XmlRpcDateTime(DateTime val)
+ {
+ this._value = val;
+ }
+
+ public override string ToString()
+ {
+ return _value.ToString();
+ }
+
+ public override int GetHashCode()
+ {
+ return _value.GetHashCode();
+ }
+
+ public override bool Equals(
+ object o)
+ {
+ if (o == null || !(o is XmlRpcDateTime))
+ return false;
+ XmlRpcDateTime dbl = o as XmlRpcDateTime;
+ return (dbl._value == _value);
+ }
+
+ public static bool operator ==(
+ XmlRpcDateTime xi,
+ XmlRpcDateTime xj)
+ {
+ if (((object)xi) == null && ((object)xj) == null)
+ return true;
+ else if (((object)xi) == null || ((object)xj) == null)
+ return false;
+ else
+ return xi._value == xj._value;
+ }
+
+ public static bool operator != (
+ XmlRpcDateTime xi,
+ XmlRpcDateTime xj)
+ {
+ return !(xi == xj);
+ }
+
+ public static implicit operator DateTime (XmlRpcDateTime x)
+ {
+ return x._value;
+ }
+
+ public static implicit operator XmlRpcDateTime(DateTime x)
+ {
+ return new XmlRpcDateTime(x);
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDocWriter.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDocWriter.cs
new file mode 100644
index 0000000..a412e8e
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDocWriter.cs
@@ -0,0 +1,474 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Collections;
+ using System.IO;
+ using System.Reflection;
+ using System.Text.RegularExpressions;
+ using System.Web.UI;
+
+ public class XmlRpcDocWriter
+ {
+ public static void WriteDoc(HtmlTextWriter wrtr, Type type,
+ bool autoDocVersion)
+ {
+ XmlRpcServiceInfo svcInfo = XmlRpcServiceInfo.CreateServiceInfo(type);
+
+ wrtr.WriteFullBeginTag("html");
+ wrtr.WriteLine();
+ WriteHead(wrtr, svcInfo.Name);
+ wrtr.WriteLine();
+ WriteBody(wrtr, type, autoDocVersion);
+ wrtr.WriteEndTag("html");
+ }
+
+ public static void WriteHead(HtmlTextWriter wrtr, string title)
+ {
+ wrtr.WriteFullBeginTag("head");
+ wrtr.WriteLine();
+ WriteStyle(wrtr);
+ WriteTitle(wrtr, title);
+ wrtr.WriteEndTag("head");
+ }
+
+ public static void WriteFooter(HtmlTextWriter wrtr, Type type,
+ bool autoDocVersion)
+ {
+ wrtr.WriteBeginTag("div");
+ wrtr.WriteAttribute("id", "content");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.WriteLine();
+
+ wrtr.WriteFullBeginTag("h2");
+ wrtr.Write("&nbsp;");
+ wrtr.WriteEndTag("h2");
+ wrtr.WriteLine();
+
+ if (autoDocVersion)
+ {
+ AssemblyName name1 = type.Assembly.GetName();
+ wrtr.Write("{0} {1}.{2}.{3}&nbsp;&nbsp;&nbsp;", name1.Name,
+ name1.Version.Major, name1.Version.Minor, name1.Version.Build);
+
+ AssemblyName name2 = typeof(XmlRpcServerProtocol).Assembly.GetName();
+ wrtr.Write("{0} {1}.{2}.{3}&nbsp;&nbsp;&nbsp;", name2.Name,
+ name2.Version.Major, name2.Version.Minor, name2.Version.Build);
+
+ wrtr.Write(".NET CLR {0}.{1}.{2}&nbsp;&nbsp;&nbsp;",
+ Environment.Version.Major,Environment.Version.Minor,
+ Environment.Version.Build);
+ }
+ wrtr.WriteEndTag("div");
+ wrtr.WriteLine();
+ }
+
+ static void WriteStyle(HtmlTextWriter wrtr)
+ {
+ wrtr.WriteBeginTag("style");
+ wrtr.WriteAttribute("type", "text/css");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.WriteLine();
+
+ wrtr.WriteLine("BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; }");
+ wrtr.WriteLine("#content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; }");
+ wrtr.WriteLine("A:link { color: #336699; font-weight: bold; text-decoration: underline; }");
+ wrtr.WriteLine("A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; }");
+ wrtr.WriteLine("A:active { color: #336699; font-weight: bold; text-decoration: underline; }");
+ wrtr.WriteLine("A:hover { color: cc3300; font-weight: bold; text-decoration: underline; }");
+ wrtr.WriteLine("P { color: #000000; margin-top: 0px; margin-bottom: 12px; font-family: Verdana; }");
+ wrtr.WriteLine("pre { background-color: #e5e5cc; padding: 5px; font-family: Courier New; font-size: x-small; margin-top: -5px; border: 1px #f0f0e0 solid; }");
+ wrtr.WriteLine("td { color: #000000; font-family: Verdana; font-size: .7em; border: solid 1px; }");
+ wrtr.WriteLine("h2 { font-size: 1.5em; font-weight: bold; margin-top: 25px; margin-bottom: 10px; border-top: 1px solid #003366; margin-left: -15px; color: #003366; }");
+ wrtr.WriteLine("h3 { font-size: 1.1em; color: #000000; margin-left: -15px; margin-top: 10px; margin-bottom: 10px; }");
+ wrtr.WriteLine("ul, ol { margin-top: 10px; margin-left: 20px; }");
+ wrtr.WriteLine("li { margin-top: 10px; color: #000000; }");
+ wrtr.WriteLine("font.value { color: darkblue; font: bold; }");
+ wrtr.WriteLine("font.key { color: darkgreen; font: bold; }");
+ wrtr.WriteLine(".heading1 { color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal; background-color: #003366; margin-top: 0px; margin-bottom: 0px; margin-left: -30px; padding-top: 10px; padding-bottom: 3px; padding-left: 15px; width: 105%; }");
+ wrtr.WriteLine(".intro { margin-left: -15px; }");
+ wrtr.WriteLine("table { border: solid 1px; }");
+
+ wrtr.WriteEndTag("style");
+ wrtr.WriteLine();
+ }
+
+ static void WriteTitle(
+ HtmlTextWriter wrtr,
+ string title)
+ {
+ wrtr.WriteFullBeginTag("title");
+ wrtr.Write(title);
+ wrtr.WriteEndTag("title");
+ wrtr.WriteLine();
+ }
+
+ public static void WriteBody(HtmlTextWriter wrtr, Type type,
+ bool autoDocVersion)
+ {
+ wrtr.WriteFullBeginTag("body");
+ wrtr.WriteLine();
+
+ WriteType(wrtr, type);
+ wrtr.WriteLine();
+
+ WriteFooter(wrtr, type, autoDocVersion);
+
+ wrtr.WriteEndTag("div");
+ wrtr.WriteLine();
+ wrtr.WriteEndTag("body");
+ wrtr.WriteLine();
+ }
+
+ public static void WriteType(
+ HtmlTextWriter wrtr,
+ Type type)
+ {
+ ArrayList structs = new ArrayList();
+
+ wrtr.WriteBeginTag("div");
+ wrtr.WriteAttribute("id", "content");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.WriteLine();
+
+ XmlRpcServiceInfo svcInfo =
+ XmlRpcServiceInfo.CreateServiceInfo(type);
+
+ wrtr.WriteBeginTag("p");
+ wrtr.WriteAttribute("class", "heading1");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write(svcInfo.Name);
+ wrtr.WriteEndTag("p");
+ wrtr.WriteFullBeginTag("br");
+ wrtr.WriteEndTag("br");
+ wrtr.WriteLine();
+
+ if (svcInfo.Doc != "")
+ {
+ wrtr.WriteBeginTag("p");
+ wrtr.WriteAttribute("class", "intro");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write(svcInfo.Doc);
+ wrtr.WriteEndTag("p");
+ wrtr.WriteLine();
+ }
+ wrtr.WriteBeginTag("p");
+ wrtr.WriteAttribute("class", "intro");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write("The following methods are supported:");
+ wrtr.WriteEndTag("p");
+ wrtr.WriteLine();
+
+ wrtr.WriteFullBeginTag("ul");
+ wrtr.WriteLine();
+ foreach (XmlRpcMethodInfo mthdInfo in svcInfo.Methods)
+ {
+ if (!mthdInfo.IsHidden)
+ {
+ wrtr.WriteFullBeginTag("li");
+ wrtr.WriteBeginTag("a");
+ wrtr.WriteAttribute("href", "#"+mthdInfo.XmlRpcName);
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write(mthdInfo.XmlRpcName);
+ wrtr.WriteEndTag("a");
+ wrtr.WriteEndTag("li");
+ wrtr.WriteLine();
+ }
+ }
+
+ wrtr.WriteEndTag("ul");
+ wrtr.WriteLine();
+
+ foreach (XmlRpcMethodInfo mthdInfo in svcInfo.Methods)
+ {
+ if (mthdInfo.IsHidden == false)
+ WriteMethod(wrtr, mthdInfo, structs);
+ }
+
+ for(int j = 0; j < structs.Count; j++)
+ {
+ WriteStruct(wrtr, structs[j] as Type, structs);
+ }
+
+ wrtr.WriteEndTag("div");
+ wrtr.WriteLine();
+ }
+
+ static void WriteMethod(
+ HtmlTextWriter wrtr,
+ XmlRpcMethodInfo mthdInfo,
+ ArrayList structs)
+ {
+ wrtr.WriteFullBeginTag("span");
+ wrtr.WriteLine();
+ wrtr.WriteFullBeginTag("h2");
+ wrtr.WriteBeginTag("a");
+ wrtr.WriteAttribute("name", "#"+mthdInfo.XmlRpcName);
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write("method " + mthdInfo.XmlRpcName);
+ wrtr.WriteEndTag("a");
+ wrtr.WriteEndTag("h2");
+ wrtr.WriteLine();
+
+ if (mthdInfo.Doc != "")
+ {
+ wrtr.WriteBeginTag("p");
+ wrtr.WriteAttribute("class", "intro");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write(mthdInfo.Doc);
+ wrtr.WriteEndTag("p");
+ wrtr.WriteLine();
+ }
+
+ wrtr.WriteFullBeginTag("h3");
+ wrtr.Write("Parameters");
+ wrtr.WriteEndTag("h3");
+ wrtr.WriteLine();
+
+ wrtr.WriteBeginTag("table");
+ wrtr.WriteAttribute("cellspacing", "0");
+ wrtr.WriteAttribute("cellpadding", "5");
+ wrtr.WriteAttribute("width", "90%");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+
+ if (mthdInfo.Parameters.Length > 0)
+ {
+ foreach (XmlRpcParameterInfo parInfo in mthdInfo.Parameters)
+ {
+ wrtr.WriteFullBeginTag("tr");
+ wrtr.WriteBeginTag("td");
+ wrtr.WriteAttribute("width", "33%");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ WriteType(wrtr, parInfo.Type, parInfo.IsParams, structs);
+ wrtr.WriteEndTag("td");
+
+ wrtr.WriteFullBeginTag("td");
+ if (parInfo.Doc == "")
+ wrtr.Write(parInfo.Name);
+ else
+ {
+ wrtr.Write(parInfo.Name);
+ wrtr.Write(" - ");
+ wrtr.Write(parInfo.Doc);
+ }
+ wrtr.WriteEndTag("td");
+ wrtr.WriteEndTag("tr");
+ }
+ }
+ else
+ {
+ wrtr.WriteFullBeginTag("tr");
+ wrtr.WriteBeginTag("td");
+ wrtr.WriteAttribute("width", "33%");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write("none");
+ wrtr.WriteEndTag("td");
+ wrtr.WriteFullBeginTag("td");
+ wrtr.Write("&nbsp;");
+ wrtr.WriteEndTag("td");
+ wrtr.WriteEndTag("tr");
+ }
+ wrtr.WriteEndTag("table");
+ wrtr.WriteLine();
+ wrtr.WriteFullBeginTag("h3");
+ wrtr.Write("Return Value");
+ wrtr.WriteEndTag("h3");
+ wrtr.WriteLine();
+
+
+ wrtr.WriteBeginTag("table");
+ wrtr.WriteAttribute("cellspacing", "0");
+ wrtr.WriteAttribute("cellpadding", "5");
+ wrtr.WriteAttribute("width", "90%");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+
+ wrtr.WriteFullBeginTag("tr");
+
+ wrtr.WriteBeginTag("td");
+ wrtr.WriteAttribute("width", "33%");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ WriteType(wrtr, mthdInfo.ReturnType, false, structs);
+ wrtr.WriteEndTag("td");
+
+ wrtr.WriteFullBeginTag("td");
+ if (mthdInfo.ReturnDoc != "")
+ wrtr.Write(mthdInfo.ReturnDoc);
+ else
+ wrtr.Write("&nbsp;");
+ wrtr.WriteEndTag("td");
+
+ wrtr.WriteEndTag("tr");
+
+ wrtr.WriteEndTag("table");
+ wrtr.WriteLine();
+
+ wrtr.WriteEndTag("span");
+ wrtr.WriteLine();
+ }
+
+ static void WriteStruct(
+ HtmlTextWriter wrtr,
+ Type structType,
+ ArrayList structs)
+ {
+ wrtr.WriteFullBeginTag("span");
+ wrtr.WriteLine();
+ wrtr.WriteFullBeginTag("h2");
+ wrtr.WriteBeginTag("a");
+ wrtr.WriteAttribute("name", "#"+structType.Name);
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write("struct " + structType.Name);
+ wrtr.WriteEndTag("a");
+ wrtr.WriteEndTag("h2");
+ wrtr.WriteLine();
+
+ wrtr.WriteFullBeginTag("h3");
+ wrtr.Write("Members");
+ wrtr.WriteEndTag("h3");
+ wrtr.WriteLine();
+ wrtr.WriteEndTag("span");
+ wrtr.WriteLine();
+
+ wrtr.WriteBeginTag("table");
+ wrtr.WriteAttribute("cellspacing", "0");
+ wrtr.WriteAttribute("cellpadding", "5");
+ wrtr.WriteAttribute("width", "90%");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+
+ MappingAction structAction = MappingAction.Error;
+ Attribute structAttr = Attribute.GetCustomAttribute(structType,
+ typeof(XmlRpcMissingMappingAttribute));
+ if (structAttr != null && structAttr is XmlRpcMissingMappingAttribute)
+ {
+ structAction = (structAttr as XmlRpcMissingMappingAttribute).Action;
+ }
+
+ MemberInfo[] mis = structType.GetMembers();
+ foreach (MemberInfo mi in mis)
+ {
+ if (mi.MemberType == MemberTypes.Field)
+ {
+ FieldInfo fi = (FieldInfo)mi;
+
+ wrtr.WriteFullBeginTag("tr");
+
+ wrtr.WriteBeginTag("td");
+ wrtr.WriteAttribute("width", "33%");
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ WriteType(wrtr, fi.FieldType, false, structs);
+ wrtr.WriteEndTag("td");
+
+ wrtr.WriteFullBeginTag("td");
+ MappingAction memberAction = structAction;
+ Attribute attr = Attribute.GetCustomAttribute(fi,
+ typeof(XmlRpcMissingMappingAttribute));
+ if (attr != null && attr is XmlRpcMissingMappingAttribute)
+ {
+ memberAction = (attr as XmlRpcMissingMappingAttribute).Action;
+ }
+ string memberName = fi.Name + " ";
+ string desc = "";
+ Attribute mmbrAttr = Attribute.GetCustomAttribute(fi,
+ typeof(XmlRpcMemberAttribute));
+ if (attr != null && mmbrAttr is XmlRpcMemberAttribute)
+ {
+ if ((mmbrAttr as XmlRpcMemberAttribute).Member != "")
+ memberName = (mmbrAttr as XmlRpcMemberAttribute).Member + " ";
+ desc = (mmbrAttr as XmlRpcMemberAttribute).Description;
+ }
+ if (memberAction == MappingAction.Ignore)
+ memberName += " (optional) ";
+ if (desc != "")
+ memberName = memberName + "- " + desc;
+ wrtr.Write(memberName);
+ wrtr.WriteEndTag("td");
+
+ wrtr.WriteEndTag("tr");
+ }
+ }
+ wrtr.WriteEndTag("table");
+ wrtr.WriteLine();
+
+ }
+
+ static void WriteType(
+ HtmlTextWriter wrtr,
+ Type type,
+ bool isparams,
+ ArrayList structs)
+ {
+ // TODO: following is hack for case when type is Object
+ string xmlRpcType;
+ if (!isparams)
+ {
+ if (type != typeof(Object))
+ xmlRpcType = XmlRpcServiceInfo.GetXmlRpcTypeString(type);
+ else
+ xmlRpcType = "any";
+ }
+ else
+ xmlRpcType = "varargs";
+ wrtr.Write(xmlRpcType);
+ if (xmlRpcType == "struct" && type != typeof(XmlRpcStruct))
+ {
+ if (!structs.Contains(type))
+ structs.Add(type);
+ wrtr.Write(" ");
+ wrtr.WriteBeginTag("a");
+ wrtr.WriteAttribute("href", "#"+type.Name);
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write(type.Name);
+ wrtr.WriteEndTag("a");
+ }
+ else if (xmlRpcType == "array" || xmlRpcType == "varargs")
+ {
+ if (type.GetArrayRank() == 1) // single dim array
+ {
+ wrtr.Write(" of ");
+ Type elemType = type.GetElementType();
+ string elemXmlRpcType;
+ if (elemType != typeof(Object))
+ elemXmlRpcType = XmlRpcServiceInfo.GetXmlRpcTypeString(elemType);
+ else
+ elemXmlRpcType = "any";
+ wrtr.Write(elemXmlRpcType);
+ if (elemXmlRpcType == "struct" && elemType != typeof(XmlRpcStruct))
+ {
+ if (!structs.Contains(elemType))
+ structs.Add(elemType);
+ wrtr.Write(" ");
+ wrtr.WriteBeginTag("a");
+ wrtr.WriteAttribute("href", "#"+elemType.Name);
+ wrtr.Write(HtmlTextWriter.TagRightChar);
+ wrtr.Write(elemType.Name);
+ wrtr.WriteEndTag("a");
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDouble.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDouble.cs
new file mode 100644
index 0000000..62e5090
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcDouble.cs
@@ -0,0 +1,91 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcDouble
+ {
+ private double _value;
+
+ public XmlRpcDouble()
+ {
+ this._value = 0;
+ }
+
+ public XmlRpcDouble(
+ double val)
+ {
+ this._value = val;
+ }
+
+ public override string ToString()
+ {
+ return _value.ToString();
+ }
+
+ public override int GetHashCode()
+ {
+ return _value.GetHashCode();
+ }
+
+ public override bool Equals(
+ object o)
+ {
+ if (o == null || !(o is XmlRpcDouble))
+ return false;
+ XmlRpcDouble dbl = o as XmlRpcDouble;
+ return dbl._value == _value;
+ }
+
+ public static bool operator ==(
+ XmlRpcDouble xi,
+ XmlRpcDouble xj)
+ {
+ if (((object)xi) == null && ((object)xj) == null)
+ return true;
+ else if (((object)xi) == null || ((object)xj) == null)
+ return false;
+ else
+ return xi._value == xj._value;
+ }
+
+ public static bool operator != (
+ XmlRpcDouble xi,
+ XmlRpcDouble xj)
+ {
+ return !(xi == xj);
+ }
+
+ public static implicit operator double (XmlRpcDouble x)
+ {
+ return x._value;
+ }
+
+ public static implicit operator XmlRpcDouble(double x)
+ {
+ return new XmlRpcDouble(x);
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcEndAttribute.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcEndAttribute.cs
new file mode 100644
index 0000000..56b08b2
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcEndAttribute.cs
@@ -0,0 +1,66 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ [AttributeUsage(AttributeTargets.Method)]
+ public class XmlRpcEndAttribute : Attribute
+ {
+ public XmlRpcEndAttribute()
+ {
+ }
+
+ public XmlRpcEndAttribute(string method)
+ {
+ this.method = method;
+ }
+
+ public string Method
+ {
+ get
+ { return method; }
+ }
+
+ public bool IntrospectionMethod
+ {
+ get { return introspectionMethod; }
+ set { introspectionMethod = value; }
+ }
+
+ public override string ToString()
+ {
+ string value = "Method : " + method;
+ return value;
+ }
+
+ public string Description = "";
+ public bool Hidden = false;
+ private string method = "";
+ private bool introspectionMethod = false;
+ }
+}
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcException.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcException.cs
new file mode 100644
index 0000000..b1d3860
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcException.cs
@@ -0,0 +1,217 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ public class XmlRpcException : ApplicationException
+ {
+ public XmlRpcException() {}
+
+ public XmlRpcException(string msg)
+ : base(msg) {}
+
+ public XmlRpcException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcUnsupportedTypeException : XmlRpcException
+ {
+ Type _unsupportedType;
+
+ public XmlRpcUnsupportedTypeException(Type t)
+ : base(string.Format("Unable to map type {0} onto XML-RPC type", t))
+ {
+ _unsupportedType = t;
+ }
+
+ public XmlRpcUnsupportedTypeException(Type t, string msg)
+ : base(msg)
+ {
+ _unsupportedType = t;
+ }
+
+ public XmlRpcUnsupportedTypeException(Type t, string msg, Exception innerEx)
+ : base(msg, innerEx)
+ {
+ _unsupportedType = t;
+ }
+
+ public Type UnsupportedType { get { return _unsupportedType; } }
+ }
+
+ public class XmlRpcUnexpectedTypeException : XmlRpcException
+ {
+ public XmlRpcUnexpectedTypeException() {}
+
+ public XmlRpcUnexpectedTypeException(string msg)
+ : base(msg) {}
+
+ public XmlRpcUnexpectedTypeException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcIllFormedXmlException : XmlRpcException
+ {
+ public XmlRpcIllFormedXmlException() {}
+
+ public XmlRpcIllFormedXmlException(string msg)
+ : base(msg) {}
+
+ public XmlRpcIllFormedXmlException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcUnsupportedMethodException : XmlRpcException
+ {
+ public XmlRpcUnsupportedMethodException() {}
+
+ public XmlRpcUnsupportedMethodException(string msg)
+ : base(msg) {}
+
+ public XmlRpcUnsupportedMethodException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcInvalidParametersException : XmlRpcException
+ {
+ public XmlRpcInvalidParametersException() {}
+
+ public XmlRpcInvalidParametersException(string msg)
+ : base(msg) {}
+
+ public XmlRpcInvalidParametersException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcNonRegularArrayException : XmlRpcException
+ {
+ public XmlRpcNonRegularArrayException() {}
+
+ public XmlRpcNonRegularArrayException(string msg)
+ : base(msg) {}
+
+ public XmlRpcNonRegularArrayException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcInvalidXmlRpcException : XmlRpcException
+ {
+ public XmlRpcInvalidXmlRpcException() {}
+
+ public XmlRpcInvalidXmlRpcException(string msg)
+ : base(msg) {}
+
+ public XmlRpcInvalidXmlRpcException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcMethodAttributeException : XmlRpcException
+ {
+ public XmlRpcMethodAttributeException() {}
+
+ public XmlRpcMethodAttributeException(string msg)
+ : base(msg) {}
+
+ public XmlRpcMethodAttributeException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcTypeMismatchException : XmlRpcException
+ {
+ public XmlRpcTypeMismatchException() {}
+
+ public XmlRpcTypeMismatchException(string msg)
+ : base(msg) {}
+
+ public XmlRpcTypeMismatchException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcNullReferenceException : XmlRpcException
+ {
+ public XmlRpcNullReferenceException() {}
+
+ public XmlRpcNullReferenceException(string msg)
+ : base(msg) {}
+
+ public XmlRpcNullReferenceException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcServerException : XmlRpcException
+ {
+ public XmlRpcServerException() {}
+
+ public XmlRpcServerException(string msg)
+ : base(msg) {}
+
+ public XmlRpcServerException(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcInvalidReturnType : XmlRpcException
+ {
+ public XmlRpcInvalidReturnType() {}
+
+ public XmlRpcInvalidReturnType(string msg)
+ : base(msg) {}
+
+ public XmlRpcInvalidReturnType(string msg, Exception innerEx)
+ : base(msg, innerEx){}
+ }
+
+ public class XmlRpcMappingSerializeException : XmlRpcException
+ {
+ public XmlRpcMappingSerializeException() { }
+
+ public XmlRpcMappingSerializeException(string msg)
+ : base(msg) { }
+
+ public XmlRpcMappingSerializeException(string msg, Exception innerEx)
+ : base(msg, innerEx) { }
+ }
+
+ public class XmlRpcNullParameterException : XmlRpcException
+ {
+ public XmlRpcNullParameterException() { }
+
+ public XmlRpcNullParameterException(string msg)
+ : base(msg) { }
+
+ public XmlRpcNullParameterException(string msg, Exception innerEx)
+ : base(msg, innerEx) { }
+ }
+
+ public class XmlRpcMissingUrl : XmlRpcException
+ {
+ public XmlRpcMissingUrl() { }
+
+ public XmlRpcMissingUrl(string msg)
+ : base(msg) { }
+ }
+
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcFaultException.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcFaultException.cs
new file mode 100644
index 0000000..197a3cb
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcFaultException.cs
@@ -0,0 +1,86 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ // used to return server-side errors to client code - also can be
+ // thrown by Service implmentation code to return custom Fault Responses
+#if (!COMPACT_FRAMEWORK)
+ [Serializable]
+#endif
+ public class XmlRpcFaultException : ApplicationException
+ {
+ // constructors
+ //
+ public XmlRpcFaultException(int TheCode, string TheString)
+ : base("Server returned a fault exception: [" + TheCode.ToString() +
+ "] " + TheString)
+ {
+ m_faultCode = TheCode;
+ m_faultString = TheString;
+ }
+#if (!COMPACT_FRAMEWORK)
+ // deserialization constructor
+ protected XmlRpcFaultException(
+ SerializationInfo info,
+ StreamingContext context)
+ : base(info, context)
+ {
+ m_faultCode = (int)info.GetValue("m_faultCode", typeof(int));
+ m_faultString = (String)info.GetValue("m_faultString", typeof(string));
+ }
+#endif
+ // properties
+ //
+ public int FaultCode
+ {
+ get { return m_faultCode; }
+ }
+
+ public string FaultString
+ {
+ get { return m_faultString; }
+ }
+#if (!COMPACT_FRAMEWORK)
+ // public methods
+ //
+ public override void GetObjectData(
+ SerializationInfo info,
+ StreamingContext context)
+ {
+ info.AddValue("m_faultCode", m_faultCode);
+ info.AddValue("m_faultString", m_faultString);
+ base.GetObjectData(info, context);
+ }
+#endif
+ // data
+ //
+ int m_faultCode;
+ string m_faultString;
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpRequest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpRequest.cs
new file mode 100644
index 0000000..f39dd8c
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpRequest.cs
@@ -0,0 +1,44 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.IO;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcHttpRequest : CookComputing.XmlRpc.IHttpRequest
+ {
+ public XmlRpcHttpRequest(System.Web.HttpRequest request)
+ {
+ m_req = request;
+ }
+
+ public Stream InputStream { get { return m_req.InputStream; } }
+
+ public string HttpMethod { get { return m_req.HttpMethod; } }
+
+ private System.Web.HttpRequest m_req;
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpResponse.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpResponse.cs
new file mode 100644
index 0000000..070e926
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpResponse.cs
@@ -0,0 +1,61 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.IO;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcHttpResponse : CookComputing.XmlRpc.IHttpResponse
+ {
+ public XmlRpcHttpResponse(System.Web.HttpResponse response)
+ {
+ m_resp = response;
+ }
+
+ string IHttpResponse.ContentType
+ {
+ get { return m_resp.ContentType; }
+ set { m_resp.ContentType = value; }
+ }
+ TextWriter IHttpResponse.Output { get { return m_resp.Output; } }
+
+ Stream IHttpResponse.OutputStream { get { return m_resp.OutputStream; } }
+
+ int IHttpResponse.StatusCode
+ {
+ get { return m_resp.StatusCode; }
+ set { m_resp.StatusCode = value; }
+ }
+
+ string IHttpResponse.StatusDescription
+ {
+ get { return m_resp.StatusDescription; }
+ set { m_resp.StatusDescription = value; }
+ }
+
+ private System.Web.HttpResponse m_resp;
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpServerProtocol.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpServerProtocol.cs
new file mode 100644
index 0000000..eb8cecd
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcHttpServerProtocol.cs
@@ -0,0 +1,100 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Text.RegularExpressions;
+using System.Web.UI;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcHttpServerProtocol : XmlRpcServerProtocol,
+ IHttpRequestHandler
+ {
+ public void HandleHttpRequest(
+ IHttpRequest httpReq,
+ IHttpResponse httpResp)
+ {
+ // GET has its own handler because it can be used to return a
+ // HTML description of the service
+ if (httpReq.HttpMethod == "GET")
+ {
+ XmlRpcServiceAttribute svcAttr = (XmlRpcServiceAttribute)
+ Attribute.GetCustomAttribute(GetType(), typeof(XmlRpcServiceAttribute));
+ if (svcAttr != null && svcAttr.AutoDocumentation == false)
+ {
+ HandleUnsupportedMethod(httpReq, httpResp);
+ }
+ else
+ {
+ bool autoDocVersion = true;
+ if (svcAttr != null)
+ autoDocVersion = svcAttr.AutoDocVersion;
+ HandleGET(httpReq, httpResp, autoDocVersion);
+ }
+ return;
+ }
+ // calls on service methods are via POST
+ if (httpReq.HttpMethod != "POST")
+ {
+ HandleUnsupportedMethod(httpReq, httpResp);
+ return;
+ }
+ //Context.Response.AppendHeader("Server", "XML-RPC.NET");
+ // process the request
+ Stream responseStream = Invoke(httpReq.InputStream);
+ Stream respStm = httpResp.OutputStream;
+ Util.CopyStream(responseStream, respStm);
+ respStm.Flush();
+ httpResp.ContentType = "text/xml";
+ }
+
+ protected void HandleGET(
+ IHttpRequest httpReq,
+ IHttpResponse httpResp,
+ bool autoDocVersion)
+ {
+ HtmlTextWriter wrtr = new HtmlTextWriter(httpResp.Output);
+ XmlRpcDocWriter.WriteDoc(wrtr, this.GetType(), autoDocVersion);
+ httpResp.StatusCode = 200;
+ }
+
+ protected void HandleUnsupportedMethod(
+ IHttpRequest httpReq,
+ IHttpResponse httpResp)
+ {
+ // RFC 2068 error 405: "The method specified in the Request-Line
+ // is not allowed for the resource identified by the Request-URI.
+ // The response MUST include an Allow header containing a list
+ // of valid methods for the requested resource."
+ //!! add Allow header
+ httpResp.StatusCode = 405;
+ httpResp.StatusDescription = "Unsupported HTTP verb";
+ }
+
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcInt.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcInt.cs
new file mode 100644
index 0000000..4095ddf
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcInt.cs
@@ -0,0 +1,90 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcInt
+ {
+ private int _value;
+
+ public XmlRpcInt()
+ {
+ this._value = 0;
+ }
+
+ public XmlRpcInt(int val)
+ {
+ this._value = val;
+ }
+
+ public override string ToString()
+ {
+ return _value.ToString();
+ }
+
+ public override int GetHashCode()
+ {
+ return _value.GetHashCode();
+ }
+
+ public override bool Equals(
+ object o)
+ {
+ if (o == null || !(o is XmlRpcInt))
+ return false;
+ XmlRpcInt dbl = o as XmlRpcInt;
+ return (dbl._value == _value);
+ }
+
+ public static bool operator ==(
+ XmlRpcInt xi,
+ XmlRpcInt xj)
+ {
+ if (((object)xi) == null && ((object)xj) == null)
+ return true;
+ else if (((object)xi) == null || ((object)xj) == null)
+ return false;
+ else
+ return xi._value == xj._value;
+ }
+
+ public static bool operator != (
+ XmlRpcInt xi,
+ XmlRpcInt xj)
+ {
+ return !(xi == xj);
+ }
+
+ public static implicit operator int (XmlRpcInt x)
+ {
+ return x._value;
+ }
+
+ public static implicit operator XmlRpcInt(int x)
+ {
+ return new XmlRpcInt (x);
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcLogger.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcLogger.cs
new file mode 100644
index 0000000..08fda9d
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcLogger.cs
@@ -0,0 +1,66 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.IO;
+using System.Diagnostics;
+
+namespace CookComputing.XmlRpc
+{
+ public abstract class XmlRpcLogger
+ {
+ public void Attach(XmlRpcClientProtocol proxy)
+ {
+ proxy.RequestEvent += new XmlRpcRequestEventHandler(OnRequest);
+ proxy.ResponseEvent += new XmlRpcResponseEventHandler(OnResponse);
+ }
+
+ public void Attach(IXmlRpcProxy proxy)
+ {
+ proxy.RequestEvent += new XmlRpcRequestEventHandler(OnRequest);
+ proxy.ResponseEvent += new XmlRpcResponseEventHandler(OnResponse);
+ }
+
+ public void Detach(XmlRpcClientProtocol proxy)
+ {
+ proxy.RequestEvent -= new XmlRpcRequestEventHandler(OnRequest);
+ proxy.ResponseEvent -= new XmlRpcResponseEventHandler(OnResponse);
+ }
+
+ public void Detach(IXmlRpcProxy proxy)
+ {
+ proxy.RequestEvent -= new XmlRpcRequestEventHandler(OnRequest);
+ proxy.ResponseEvent -= new XmlRpcResponseEventHandler(OnResponse);
+ }
+
+ protected virtual void OnRequest(object sender, XmlRpcRequestEventArgs e)
+ {
+ }
+
+ protected virtual void OnResponse(object sender, XmlRpcResponseEventArgs e)
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMemberAttribute.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMemberAttribute.cs
new file mode 100644
index 0000000..c03db09
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMemberAttribute.cs
@@ -0,0 +1,65 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ [AttributeUsage(AttributeTargets.Field|AttributeTargets.Property)]
+ public class XmlRpcMemberAttribute : Attribute
+ {
+ public XmlRpcMemberAttribute()
+ {
+ }
+
+ public XmlRpcMemberAttribute(string member)
+ {
+ _member = member;
+ }
+
+ public string Member
+ {
+ get
+ { return _member; }
+ set
+ { _member = value; }
+ }
+
+ public string Description
+ {
+ get { return _description; }
+ set { _description = value; }
+ }
+
+ public override string ToString()
+ {
+ string value = "Member : " + _member;
+ return value;
+ }
+
+ private string _member = "";
+ private string _description = "";
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMethodAttribute.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMethodAttribute.cs
new file mode 100644
index 0000000..23d8d24
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMethodAttribute.cs
@@ -0,0 +1,65 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ [AttributeUsage(AttributeTargets.Method)]
+ public class XmlRpcMethodAttribute : Attribute
+ {
+ public XmlRpcMethodAttribute()
+ {
+ }
+
+ public XmlRpcMethodAttribute(string method)
+ {
+ this.method = method;
+ }
+
+ public string Method
+ {
+ get
+ { return method; }
+ }
+
+ public bool IntrospectionMethod
+ {
+ get { return introspectionMethod; }
+ set { introspectionMethod = value; }
+ }
+
+ public override string ToString()
+ {
+ string value = "Method : " + method;
+ return value;
+ }
+
+ public string Description = "";
+ public bool Hidden = false;
+ private string method = "";
+ private bool introspectionMethod = false;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMethodInfo.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMethodInfo.cs
new file mode 100644
index 0000000..514f5a5
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMethodInfo.cs
@@ -0,0 +1,107 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Reflection;
+
+ public class XmlRpcMethodInfo : IComparable
+ {
+ public XmlRpcMethodInfo()
+ {
+ }
+
+ public bool IsHidden
+ {
+ get { return isHidden; }
+ set { isHidden = value; }
+ }
+
+ public String Doc
+ {
+ get { return doc; }
+ set { doc = value; }
+ }
+
+ public MethodInfo MethodInfo
+ {
+ get { return mi; }
+ set { mi = value; }
+ }
+
+ public String MiName
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public XmlRpcParameterInfo[] Parameters
+ {
+ get { return paramInfos; }
+ set { paramInfos = value; }
+ }
+
+ public Type ReturnType
+ {
+ get { return returnType; }
+ set { returnType = value; }
+ }
+
+ public string ReturnXmlRpcType
+ {
+ get { return returnXmlRpcType; }
+ set { returnXmlRpcType = value; }
+ }
+
+ public String ReturnDoc
+ {
+ get { return returnDoc; }
+ set { returnDoc = value; }
+ }
+
+ public String XmlRpcName
+ {
+ get { return xmlRpcName; }
+ set { xmlRpcName = value; }
+ }
+
+ public int CompareTo(object obj)
+ {
+ XmlRpcMethodInfo xmi = (XmlRpcMethodInfo)obj;
+ return this.xmlRpcName.CompareTo(xmi.xmlRpcName);
+ }
+
+ MethodInfo mi;
+ bool isHidden;
+ string doc="";
+ string name="";
+ string xmlRpcName="";
+ string returnDoc="";
+ Type returnType;
+ string returnXmlRpcType;
+ XmlRpcParameterInfo[] paramInfos;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMissingMappingAttribute.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMissingMappingAttribute.cs
new file mode 100644
index 0000000..11fa783
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcMissingMappingAttribute.cs
@@ -0,0 +1,63 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ public enum MappingAction
+ {
+ Ignore,
+ Error
+ }
+
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Struct
+ | AttributeTargets.Property | AttributeTargets.Class)]
+ public class XmlRpcMissingMappingAttribute : Attribute
+ {
+ public XmlRpcMissingMappingAttribute()
+ {
+ }
+
+ public XmlRpcMissingMappingAttribute(MappingAction action)
+ {
+ _action = action;
+ }
+
+ public MappingAction Action
+ {
+ get
+ { return _action; }
+ }
+
+ public override string ToString()
+ {
+ string value = _action.ToString();
+ return value;
+ }
+
+ private MappingAction _action = MappingAction.Error;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcNonStandard.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcNonStandard.cs
new file mode 100644
index 0000000..61d1786
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcNonStandard.cs
@@ -0,0 +1,43 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.Text;
+
+namespace CookComputing.XmlRpc
+{
+ [Flags]
+ public enum XmlRpcNonStandard
+ {
+ None = 0x00,
+ AllowStringFaultCode = 0x01,
+ AllowNonStandardDateTime = 0x02,
+ IgnoreDuplicateMembers = 0x4,
+ MapZerosDateTimeToMinValue = 0x8,
+ MapEmptyDateTimeToMinValue = 0x10,
+ AllowInvalidHTTPContent = 0x20,
+ All = 0x7fff,
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcParameterAttribute.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcParameterAttribute.cs
new file mode 100644
index 0000000..5d239de
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcParameterAttribute.cs
@@ -0,0 +1,62 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ [AttributeUsage(AttributeTargets.Parameter)]
+ public class XmlRpcParameterAttribute : Attribute
+ {
+ public XmlRpcParameterAttribute()
+ {
+ }
+
+ public XmlRpcParameterAttribute(string name)
+ {
+ this.name = name;
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public override string ToString()
+ {
+ string value = "Description : " + description;
+ return value;
+ }
+
+ private string name = "";
+ private string description = "";
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcParameterInfo.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcParameterInfo.cs
new file mode 100644
index 0000000..29fcdc4
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcParameterInfo.cs
@@ -0,0 +1,84 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ public class XmlRpcParameterInfo
+ {
+ public XmlRpcParameterInfo()
+ {
+ }
+
+ public String Doc
+ {
+ get { return doc; }
+ set { doc = value; }
+ }
+
+ public bool IsParams
+ {
+ get { return isparams; }
+ set { isparams = value; }
+ }
+
+ public String Name
+ {
+ get { return name; }
+ set
+ {
+ name = value;
+ if (xmlRpcName == "")
+ xmlRpcName = name;
+ }
+ }
+
+ public String XmlRpcName
+ {
+ get { return xmlRpcName; }
+ set { xmlRpcName = value; }
+ }
+
+ public Type Type
+ {
+ get { return type; }
+ set { type = value; }
+ }
+
+ public string XmlRpcType
+ {
+ get { return xmlRpcType; }
+ set { xmlRpcType = value; }
+ }
+
+ string doc;
+ string name;
+ Type type;
+ string xmlRpcName;
+ string xmlRpcType;
+ bool isparams;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcProxyCodeGen.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcProxyCodeGen.cs
new file mode 100644
index 0000000..1fdcb3c
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcProxyCodeGen.cs
@@ -0,0 +1,953 @@
+/*
+XML-RPC.NET proxy class code generator
+Copyright (c) 2003, Joe Bork <joe@headblender.com>
+Portions Copyright (c) 2001-2003, Charles Cook <ccook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace Headblender.XmlRpc
+{
+ using System;
+ using System.Collections;
+ using System.Reflection;
+
+ using System.Globalization;
+ using System.Text;
+ using System.IO;
+ using System.CodeDom;
+ using System.CodeDom.Compiler;
+
+ using CookComputing.XmlRpc;
+
+ public sealed class XmlRpcProxyCodeGenOptions
+ {
+ private string GenNamespace = "";
+ private string GenTypeName = "";
+ private bool GenImplicitAsync = false;
+ private bool GenFlattenInterfaces = false;
+
+ public XmlRpcProxyCodeGenOptions()
+ {
+ GenNamespace = "";
+ GenTypeName = "";
+ GenImplicitAsync = false;
+ GenFlattenInterfaces = false;
+ }
+
+ public XmlRpcProxyCodeGenOptions(
+ string initNamespace,
+ string initTypeName,
+ bool initImplicitAsync,
+ bool flattenInterfaces)
+ {
+ GenNamespace = initNamespace;
+ GenTypeName = initTypeName;
+ GenImplicitAsync = initImplicitAsync;
+ GenFlattenInterfaces = flattenInterfaces;
+ }
+
+ public string Namespace
+ {
+ get
+ {
+ return GenNamespace;
+ }
+
+ set
+ {
+ GenNamespace = value;
+ }
+ }
+
+ public string TypeName
+ {
+ get
+ {
+ return GenTypeName;
+ }
+
+ set
+ {
+ GenTypeName = value;
+ }
+ }
+
+ public bool ImplicitAsync
+ {
+ get
+ {
+ return GenImplicitAsync;
+ }
+
+ set
+ {
+ GenImplicitAsync = value;
+ }
+ }
+
+ public bool FlattenInterfaces
+ {
+ get
+ {
+ return GenFlattenInterfaces;
+ }
+
+ set
+ {
+ GenFlattenInterfaces = value;
+ }
+ }
+ }
+
+ public sealed class XmlRpcProxyCodeGen
+ {
+ const string DEFAULT_RET = "xrtReturn";
+ const string DEFAULT_TEMP = "xrtTemp";
+ const string DEFAULT_ARR = "xrtArray";
+ const string DEFAULT_CALLBACK = "xrtCallback";
+ const string DEFAULT_STATUS = "xrtStatus";
+ const string DEFAULT_RESULT = "xrtResult";
+
+ const string DEFAULT_SUFFIX = "RpcProxy";
+ const string DEFAULT_END = "End";
+ const string DEFAULT_BEGIN = "Begin";
+
+ private XmlRpcProxyCodeGen()
+ {
+ // no public constructor where all public methods are static
+ }
+
+ private delegate void BuildMethodDelegate(
+ CodeTypeDeclaration declaration,
+ string methodName,
+ string rpcMethodName,
+ Type[] argTypes,
+ string[] argNames,
+ Type returnType,
+ Type implementationType);
+
+ public static string CreateCode(
+ Type proxyType,
+ ICodeGenerator generator)
+ {
+ return CreateCode(proxyType, generator, new XmlRpcProxyCodeGenOptions());
+ }
+
+ public static string CreateCode(
+ Type proxyType,
+ ICodeGenerator generator,
+ XmlRpcProxyCodeGenOptions options)
+ {
+ if (options == null)
+ {
+ throw new ArgumentNullException(
+ "options",
+ "The options parameter cannot be null");
+ }
+
+ CodeCompileUnit ccu = CreateCodeCompileUnit(proxyType, generator, options);
+
+ CodeGeneratorOptions cgo = new CodeGeneratorOptions();
+ cgo.BlankLinesBetweenMembers = true;
+ cgo.BracingStyle = "C";
+
+ StringWriter sw = new StringWriter(CultureInfo.InvariantCulture);
+
+ generator.GenerateCodeFromCompileUnit(ccu, sw, cgo);
+
+ string ret = sw.ToString();
+
+ return ret;
+ }
+
+ public static CodeCompileUnit CreateCodeCompileUnit(
+ Type proxyType,
+ ICodeGenerator generator)
+ {
+ return CreateCodeCompileUnit(proxyType, generator, new XmlRpcProxyCodeGenOptions());
+ }
+
+ public static CodeCompileUnit CreateCodeCompileUnit(
+ Type proxyType,
+ ICodeGenerator generator,
+ XmlRpcProxyCodeGenOptions options)
+ {
+ if (options == null)
+ {
+ throw new ArgumentNullException(
+ "options",
+ "The options parameter cannot be null");
+ }
+
+ // create unique names
+ string baseName = proxyType.Name;
+
+ // string leading "I"
+ if (baseName.StartsWith("I") == true)
+ {
+ baseName = baseName.Remove(0,1);
+ }
+
+ string moduleName = String.Format(
+ CultureInfo.InvariantCulture,
+ "{0}{1}.dll",
+ baseName,
+ DEFAULT_SUFFIX);
+
+ string assemblyName = "";
+ if (options.Namespace.Length > 0)
+ {
+ assemblyName = options.Namespace;
+ }
+ else
+ {
+ assemblyName = String.Format(
+ CultureInfo.InvariantCulture,
+ "{0}{1}",
+ baseName,
+ DEFAULT_SUFFIX);
+ }
+
+ string typeName = "";
+ if (options.TypeName.Length > 0)
+ {
+ typeName = options.TypeName;
+ }
+ else
+ {
+ typeName = assemblyName;
+ }
+
+ bool implicitAsync = options.ImplicitAsync;
+ bool flattenInterfaces = options.FlattenInterfaces;
+
+ CodeCompileUnit ccu = BuildCompileUnit(
+ proxyType,
+ assemblyName,
+ moduleName,
+ typeName,
+ implicitAsync,
+ flattenInterfaces);
+
+ return ccu;
+ }
+
+ private static CodeCompileUnit BuildCompileUnit(
+ Type proxyType,
+ string assemblyName,
+ string moduleName,
+ string typeName,
+ bool implicitAsync,
+ bool flattenInterfaces)
+ {
+ string urlString = GetXmlRpcUrl(proxyType);
+ Hashtable methods = GetXmlRpcMethods(proxyType, flattenInterfaces);
+ Hashtable beginMethods = GetXmlRpcBeginMethods(proxyType, flattenInterfaces);
+ Hashtable endMethods = GetXmlRpcEndMethods(proxyType, flattenInterfaces);
+
+ // if there are no Begin and End methods,
+ // we can implicitly generate them
+ if ((beginMethods.Count == 0) && (endMethods.Count == 0) && (implicitAsync == true))
+ {
+ beginMethods = GetXmlRpcMethods(proxyType, flattenInterfaces);
+ endMethods = GetXmlRpcMethods(proxyType, flattenInterfaces);
+ }
+
+ CodeCompileUnit ccu = new CodeCompileUnit();
+
+ CodeNamespace cn = new CodeNamespace(assemblyName);
+
+ cn.Imports.Add(new CodeNamespaceImport("System"));
+ cn.Imports.Add(new CodeNamespaceImport(proxyType.Namespace));
+ cn.Imports.Add(new CodeNamespaceImport("CookComputing.XmlRpc"));
+
+ CodeTypeDeclaration ctd = new CodeTypeDeclaration(typeName);
+
+ // its a class
+ ctd.IsClass = true;
+ // class is public and sealed
+ ctd.TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed;
+ // class derives from XmlRpcClientProtocol
+ ctd.BaseTypes.Add(typeof(XmlRpcClientProtocol));
+ // and implements I(itf)
+ ctd.BaseTypes.Add(proxyType);
+
+ BuildConstructor(ctd, typeof(XmlRpcClientProtocol), urlString);
+ BuildMethods(ctd, methods, new BuildMethodDelegate(BuildStandardMethod));
+ BuildMethods(ctd, beginMethods, new BuildMethodDelegate(BuildBeginMethod));
+ BuildMethods(ctd, endMethods, new BuildMethodDelegate(BuildEndMethod));
+
+ cn.Types.Add(ctd);
+ ccu.Namespaces.Add(cn);
+
+ return ccu;
+ }
+
+ private static void BuildMethods(
+ CodeTypeDeclaration declaration,
+ Hashtable methods,
+ BuildMethodDelegate buildDelegate)
+ {
+ foreach (DictionaryEntry de in methods)
+ {
+ MethodData mthdData = (MethodData)de.Value;
+ MethodInfo mi = mthdData.mi;
+ Type[] argTypes = new Type[mi.GetParameters().Length];
+ string[] argNames = new string[mi.GetParameters().Length];
+ for(int i = 0; i < mi.GetParameters().Length; i++)
+ {
+ argTypes[i] = mi.GetParameters()[i].ParameterType;
+ argNames[i] = mi.GetParameters()[i].Name;
+ }
+ //buildDelegate(declaration, mi.Name, mthdData.xmlRpcName, argTypes, argNames, mi.ReturnType);
+ string n = (string)de.Key;
+ buildDelegate(
+ declaration,
+ n,
+ mthdData.xmlRpcName,
+ argTypes,
+ argNames,
+ mi.ReturnType,
+ mthdData.implementationType);
+ }
+ }
+
+ private static void BuildStandardMethod(
+ CodeTypeDeclaration declaration,
+ string methodName,
+ string rpcMethodName,
+ Type[] argTypes,
+ string[] argNames,
+ Type returnType,
+ Type implementationType)
+ {
+ CodeMemberMethod cmm = new CodeMemberMethod();
+
+ // set the attributes and name
+
+ // normal, unqualified type names are public
+ cmm.Attributes = MemberAttributes.Public | MemberAttributes.Final;
+
+ cmm.ImplementationTypes.Add(implementationType);
+
+ cmm.Name = methodName;
+
+ // set the return type
+ CodeTypeReference ctrReturn = new CodeTypeReference(returnType);
+ cmm.ReturnType = ctrReturn;
+
+ MakeParameterList(cmm, argTypes, argNames);
+
+ // add an XmlRpcMethod attribute to the type
+ CodeAttributeDeclaration cad = new CodeAttributeDeclaration();
+ cad.Name = typeof(XmlRpcMethodAttribute).FullName;
+
+ CodeAttributeArgument caa = new CodeAttributeArgument();
+ CodePrimitiveExpression cpe = new CodePrimitiveExpression(rpcMethodName);
+ caa.Value = cpe;
+
+ cad.Arguments.Add(caa);
+
+ cmm.CustomAttributes.Add(cad);
+
+ // generate the method body:
+
+ // if non-void return, declared locals for processing return value
+ if (returnType != typeof(void))
+ {
+ // add some local variables
+ MakeTempVariable(cmm, typeof(System.Object));
+ MakeReturnVariable(cmm, returnType);
+ }
+
+ MakeTempParameterArray(cmm, argTypes, argNames);
+
+ // construct a call to the base Invoke method
+ CodeThisReferenceExpression ctre = new CodeThisReferenceExpression();
+
+ CodeMethodReferenceExpression cmre = new CodeMethodReferenceExpression(ctre, "Invoke");
+
+ CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression();
+ cmie.Method = cmre;
+ cmie.Parameters.Add(new CodePrimitiveExpression(methodName));
+ cmie.Parameters.Add(new CodeVariableReferenceExpression(DEFAULT_ARR));
+
+ if (returnType != typeof(void))
+ {
+ // assign the result to tempRetVal
+ CodeAssignStatement casTemp = new CodeAssignStatement();
+ casTemp.Left = new CodeVariableReferenceExpression(DEFAULT_TEMP);
+ casTemp.Right = cmie;
+
+ cmm.Statements.Add(casTemp);
+ }
+ else
+ {
+ // discard return type
+ cmm.Statements.Add(cmie);
+ }
+
+ MakeReturnStatement(cmm, returnType);
+
+ // add the finished method to the type
+ declaration.Members.Add(cmm);
+ }
+
+ private static void BuildBeginMethod(
+ CodeTypeDeclaration declaration,
+ string methodName,
+ string rpcMethodName,
+ Type[] argTypes,
+ string[] argNames,
+ Type returnType,
+ Type implementationType)
+ {
+ string beginMethodName = "";
+
+ CodeMemberMethod cmm = new CodeMemberMethod();
+
+ // set the attributes and name
+ cmm.Attributes = MemberAttributes.Public | MemberAttributes.Final;
+
+ if (methodName.StartsWith(DEFAULT_BEGIN) == true)
+ {
+ // strip method name prefix
+ cmm.Name = methodName.Substring(DEFAULT_BEGIN.Length, methodName.Length - DEFAULT_BEGIN.Length);
+ }
+ beginMethodName = String.Format(CultureInfo.InvariantCulture, "{0}{1}", DEFAULT_BEGIN, methodName);
+
+ cmm.Name = beginMethodName;
+
+ //!cmm.ImplementationTypes.Add(implementationType);
+
+ // set the return type (always IAsyncResult)
+ cmm.ReturnType = new CodeTypeReference(typeof(System.IAsyncResult));
+
+ MakeParameterList(cmm, argTypes, argNames);
+
+ // add callback and state params
+ cmm.Parameters.Add(new CodeParameterDeclarationExpression(
+ typeof(System.AsyncCallback),
+ DEFAULT_CALLBACK)
+ );
+
+ cmm.Parameters.Add(new CodeParameterDeclarationExpression(
+ typeof(System.Object),
+ DEFAULT_STATUS)
+ );
+
+ MakeReturnVariable(cmm, typeof(System.IAsyncResult));
+
+ MakeTempParameterArray(cmm, argTypes, argNames);
+
+ // construct a call to the base beginInvoke method
+
+ CodeThisReferenceExpression ctre = new CodeThisReferenceExpression();
+
+ CodeMethodReferenceExpression cmre = new CodeMethodReferenceExpression(ctre, "BeginInvoke");
+
+ CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression();
+ cmie.Method = cmre;
+ cmie.Parameters.Add(new CodePrimitiveExpression(methodName));
+ cmie.Parameters.Add(new CodeVariableReferenceExpression(DEFAULT_ARR));
+ cmie.Parameters.Add(new CodeVariableReferenceExpression(DEFAULT_CALLBACK));
+ cmie.Parameters.Add(new CodeVariableReferenceExpression(DEFAULT_STATUS));
+
+ // assign the result to RetVal
+ CodeAssignStatement casTemp = new CodeAssignStatement();
+ casTemp.Left = new CodeVariableReferenceExpression(DEFAULT_RET);
+ casTemp.Right = cmie;
+
+ cmm.Statements.Add(casTemp);
+
+ // return retVal
+ CodeMethodReturnStatement cmrsCast = new CodeMethodReturnStatement();
+ cmrsCast.Expression = new CodeVariableReferenceExpression(DEFAULT_RET);
+
+ cmm.Statements.Add(cmrsCast);
+
+ // add the finished method to the type
+ declaration.Members.Add(cmm);
+ }
+
+ private static void BuildEndMethod(
+ CodeTypeDeclaration declaration,
+ string methodName,
+ string rpcMethodName,
+ Type[] argTypes,
+ string[] argNames,
+ Type returnType,
+ Type implementationType)
+ {
+ string endMethodName = "";
+
+ CodeMemberMethod cmm = new CodeMemberMethod();
+
+ // set the attributes and name
+ cmm.Attributes = MemberAttributes.Public | MemberAttributes.Final;
+
+ if (methodName.StartsWith(DEFAULT_END) == true)
+ {
+ // strip method name prefix
+ cmm.Name = methodName.Substring(DEFAULT_END.Length, methodName.Length - DEFAULT_END.Length);
+ }
+ endMethodName = String.Format(CultureInfo.InvariantCulture, "{0}{1}", DEFAULT_END, methodName);
+
+ cmm.Name = endMethodName;
+
+ //!cmm.ImplementationTypes.Add(implementationType);
+
+ // set the return type
+ CodeTypeReference ctrReturn = new CodeTypeReference(returnType);
+ cmm.ReturnType = ctrReturn;
+
+ // set the parameter list (always a single IAsyncResult)
+ CodeParameterDeclarationExpression cpde = new CodeParameterDeclarationExpression();
+
+ cpde.Name = DEFAULT_RESULT;
+ cpde.Type = new CodeTypeReference(typeof(System.IAsyncResult));
+
+ cmm.Parameters.Add(cpde);
+
+ // generate the method body:
+
+ // if non-void return, declared locals for processing return value
+ if (returnType != typeof(void))
+ {
+ // add some local variables:
+ MakeTempVariable(cmm, typeof(System.Object));
+ MakeReturnVariable(cmm, returnType);
+ }
+
+ // construct a call to the base EndInvoke method
+
+ CodeThisReferenceExpression ctre = new CodeThisReferenceExpression();
+
+ CodeMethodReferenceExpression cmre = new CodeMethodReferenceExpression(ctre, "EndInvoke");
+
+ CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression();
+ cmie.Method = cmre;
+ cmie.Parameters.Add(new CodeVariableReferenceExpression(DEFAULT_RESULT));
+
+ CodeIndexerExpression cie = new CodeIndexerExpression();
+ cie.TargetObject = cmie;
+ cie.Indices.Add(new CodePrimitiveExpression(0));
+
+ if (returnType != typeof(void))
+ {
+ // assign the result to tempRetVal
+ CodeAssignStatement casTemp = new CodeAssignStatement();
+ casTemp.Left = new CodeVariableReferenceExpression(DEFAULT_TEMP);
+ //!casTemp.Right = cie;
+ casTemp.Right = cmie;
+
+ cmm.Statements.Add(casTemp);
+ }
+ else
+ {
+ // discard return type
+ //!cmm.Statements.Add(cie);
+ cmm.Statements.Add(cmie);
+ }
+
+ MakeReturnStatement(cmm, returnType);
+
+ // add the finished method to the type
+ declaration.Members.Add(cmm);
+ }
+
+ private static void BuildConstructor(
+ CodeTypeDeclaration declaration,
+ Type baseType,
+ string urlStr)
+ {
+ CodeConstructor cc = new CodeConstructor();
+
+ if (urlStr != null && urlStr.Length > 0)
+ {
+ // add an XmlRpcUrl attribute to the type
+ CodeAttributeDeclaration cad = new CodeAttributeDeclaration();
+ cad.Name = typeof(XmlRpcUrlAttribute).FullName;
+
+ CodeAttributeArgument caa = new CodeAttributeArgument();
+ CodePrimitiveExpression cpe = new CodePrimitiveExpression(urlStr);
+ caa.Value = cpe;
+
+ cad.Arguments.Add(caa);
+ declaration.CustomAttributes.Add(cad);
+ }
+
+ // call the base constructor:
+ cc.Attributes = MemberAttributes.Public;
+
+ // add the constructor to the type
+ declaration.Members.Add(cc);
+ }
+
+
+ // ==========================================================================
+
+ private static string GetXmlRpcUrl(Type proxyType)
+ {
+ Attribute attr = Attribute.GetCustomAttribute(
+ proxyType,
+ typeof(XmlRpcUrlAttribute));
+ if (attr == null)
+ return null;
+ XmlRpcUrlAttribute xruAttr = attr as XmlRpcUrlAttribute;
+ string url = xruAttr.Uri;
+ return url;
+ }
+
+
+ private static Hashtable GetXmlRpcMethods(Type proxyType, bool flatten)
+ {
+ Hashtable ret = new Hashtable();
+
+ RecurseGetXmlRpcMethods(proxyType, ref ret, flatten);
+
+ return ret;
+ }
+
+ private static void RecurseGetXmlRpcMethods(Type proxyType, ref Hashtable h, bool flatten)
+ {
+ if (!proxyType.IsInterface)
+ throw new Exception("type not interface");
+
+ foreach(MethodInfo mi in proxyType.GetMethods())
+ {
+ string xmlRpcName = GetXmlRpcMethodName(mi);
+ if (xmlRpcName == null)
+ continue;
+
+ string n = mi.Name;
+
+ if (h.Contains(n) == true)
+ {
+ throw new Exception("duplicate method name encountered in type hierarchy");
+ }
+
+ // add new method
+ h.Add(n, new MethodData(mi, xmlRpcName, mi.ReturnType, proxyType));
+ }
+
+ if (flatten == true)
+ {
+ Type[] ifs = proxyType.GetInterfaces();
+ for (int i = 0; i < ifs.Length; ++i)
+ {
+ RecurseGetXmlRpcMethods(ifs[i], ref h, flatten);
+ }
+ }
+ }
+
+
+ private static Hashtable GetXmlRpcBeginMethods(Type proxyType, bool flatten)
+ {
+ Hashtable ret = new Hashtable();
+
+ RecurseGetXmlRpcBeginMethods(proxyType, ref ret, flatten);
+
+ return ret;
+ }
+
+ private static void RecurseGetXmlRpcBeginMethods(Type proxyType, ref Hashtable h, bool flatten)
+ {
+ if (!proxyType.IsInterface)
+ throw new Exception("type not interface");
+ foreach(MethodInfo mi in proxyType.GetMethods())
+ {
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcBeginAttribute));
+ if (attr == null)
+ continue;
+ string rpcMethod = ((XmlRpcBeginAttribute)attr).Method;
+ if (rpcMethod.Length == 0)
+ {
+ if (!mi.Name.StartsWith("Begin") || mi.Name.Length <= 5)
+ throw new Exception(String.Format(
+ CultureInfo.InvariantCulture,
+ "method {0} has invalid signature for begin method",
+ mi.Name));
+ rpcMethod = mi.Name.Substring(5);
+ }
+ int paramCount = mi.GetParameters().Length;
+ int i;
+ for (i = 0; i < paramCount; i++)
+ {
+ Type paramType = mi.GetParameters()[0].ParameterType;
+ if (paramType == typeof(System.AsyncCallback))
+ break;
+ }
+ if (paramCount > 1)
+ {
+ if (i < paramCount - 2)
+ throw new Exception(String.Format(
+ CultureInfo.InvariantCulture,
+ "method {0} has invalid signature for begin method", mi.Name));
+ if (i == (paramCount - 2))
+ {
+ Type paramType = mi.GetParameters()[i+1].ParameterType;
+ if (paramType != typeof(System.Object))
+ throw new Exception(String.Format(
+ CultureInfo.InvariantCulture,
+ "method {0} has invalid signature for begin method",
+ mi.Name));
+ }
+ }
+ string n = mi.Name;
+
+ if (h.Contains(n) == true)
+ {
+ throw new Exception("duplicate begin method name encountered in type hierarchy");
+ }
+
+ h.Add(n, new MethodData(mi, rpcMethod, null, null));
+ }
+
+
+ if (flatten == true)
+ {
+ Type[] ifs = proxyType.GetInterfaces();
+ for (int i = 0; i < ifs.Length; ++i)
+ {
+ RecurseGetXmlRpcBeginMethods(ifs[i], ref h, flatten);
+ }
+ }
+ }
+
+
+ private static Hashtable GetXmlRpcEndMethods(Type proxyType, bool flatten)
+ {
+ Hashtable ret = new Hashtable();
+
+ RecurseGetXmlRpcEndMethods(proxyType, ref ret, flatten);
+
+ return ret;
+ }
+
+ private static void RecurseGetXmlRpcEndMethods(Type proxyType, ref Hashtable h, bool flatten)
+ {
+ if (!proxyType.IsInterface)
+ throw new Exception("type not interface");
+ foreach(MethodInfo mi in proxyType.GetMethods())
+ {
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcEndAttribute));
+ if (attr == null)
+ continue;
+ if (mi.GetParameters().Length != 1)
+ throw new Exception(String.Format(
+ CultureInfo.InvariantCulture,
+ "method {0} has invalid signature for end method", mi.Name));
+ Type paramType = mi.GetParameters()[0].ParameterType;
+ if (paramType != typeof(System.IAsyncResult))
+ throw new Exception(String.Format(
+ CultureInfo.InvariantCulture,
+ "method {0} has invalid signature for end method", mi.Name));
+
+ string n = mi.Name;
+
+ if (h.Contains(n) == true)
+ {
+ throw new Exception("duplicate end method name encountered in type hierarchy");
+ }
+
+ h.Add(h, new MethodData(mi, "", null, null));
+ }
+
+ if (flatten == true)
+ {
+ Type[] ifs = proxyType.GetInterfaces();
+ for (int i = 0; i < ifs.Length; ++i)
+ {
+ RecurseGetXmlRpcEndMethods(ifs[i], ref h, flatten);
+ }
+ }
+ }
+
+
+ private static string GetXmlRpcMethodName(MethodInfo mi)
+ {
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcMethodAttribute));
+ if (attr == null)
+ return null;
+ XmlRpcMethodAttribute xrmAttr = attr as XmlRpcMethodAttribute;
+ string rpcMethod = xrmAttr.Method;
+ if (rpcMethod.Length == 0)
+ {
+ rpcMethod = mi.Name;
+ }
+ return rpcMethod;
+ }
+
+ private class MethodData
+ {
+ public MethodData(MethodInfo Mi, string XmlRpcName, Type ReturnType, Type ImplementationType)
+ {
+ m_mi = Mi;
+ m_xmlRpcName = XmlRpcName;
+ m_returnType = ReturnType;
+ m_implementationType = ImplementationType;
+ }
+
+ private MethodInfo m_mi;
+ private string m_xmlRpcName;
+ private Type m_returnType;
+ private Type m_implementationType;
+
+ public MethodInfo mi
+ {
+ get { return m_mi; }
+ set { m_mi = value; }
+ }
+
+ public string xmlRpcName
+ {
+ get { return m_xmlRpcName; }
+ set { m_xmlRpcName = value; }
+ }
+
+ public Type returnType
+ {
+ get { return m_returnType; }
+ set { m_returnType = value; }
+ }
+
+ public Type implementationType
+ {
+ get { return m_implementationType; }
+ set { m_implementationType = value; }
+ }
+ }
+
+
+ // ==========================================================================
+
+ private static void MakeParameterList(CodeMemberMethod method, Type[] types, string[] names)
+ {
+ // set the parameter list
+ for (int i = 0; i < types.Length; ++i)
+ {
+ CodeParameterDeclarationExpression cpde = new CodeParameterDeclarationExpression();
+
+ cpde.Name = names[i];
+
+ CodeTypeReference ctr = new CodeTypeReference(types[i]);
+ cpde.Type = ctr;
+
+ method.Parameters.Add(cpde);
+ }
+ }
+
+ private static void MakeReturnVariable(CodeMemberMethod method, Type returnType)
+ {
+ // return variable
+ CodeVariableDeclarationStatement cvdsRet = new CodeVariableDeclarationStatement();
+ cvdsRet.Name = DEFAULT_RET;
+ cvdsRet.Type = new CodeTypeReference(returnType);
+
+ if (returnType.IsValueType == false)
+ {
+ cvdsRet.InitExpression = new CodePrimitiveExpression(null);
+ }
+
+ method.Statements.Add(cvdsRet);
+ }
+
+ private static void MakeTempVariable(CodeMemberMethod method, Type tempType)
+ {
+ // temp object variable
+ CodeVariableDeclarationStatement cvdsTemp = new CodeVariableDeclarationStatement();
+ cvdsTemp.Name = DEFAULT_TEMP;
+ cvdsTemp.Type = new CodeTypeReference(tempType);
+
+ if (tempType.IsValueType == false)
+ {
+ cvdsTemp.InitExpression = new CodePrimitiveExpression(null);
+ }
+
+ method.Statements.Add(cvdsTemp);
+ }
+
+ private static void MakeTempParameterArray(CodeMemberMethod method, Type[] types, string[] names)
+ {
+
+ // declare array variable to store method args
+ CodeVariableDeclarationStatement cvdsArr = new CodeVariableDeclarationStatement();
+ cvdsArr.Name = DEFAULT_ARR;
+
+ CodeTypeReference ctrArrType = new CodeTypeReference(typeof(System.Object));
+ CodeTypeReference ctrArr = new CodeTypeReference(ctrArrType, 1);
+
+ cvdsArr.Type = ctrArr;
+
+ // gen code to initialize the array
+ CodeArrayCreateExpression cace = new CodeArrayCreateExpression(typeof(System.Object), 1);
+
+ // create array initializers
+ for (int i = 0; i < types.Length; ++i)
+ {
+ CodeArgumentReferenceExpression care = new CodeArgumentReferenceExpression();
+ care.ParameterName = names[i];
+
+ cace.Initializers.Add(care);
+ }
+
+ cvdsArr.InitExpression = cace;
+
+ method.Statements.Add(cvdsArr);
+ }
+
+ private static void MakeReturnStatement(CodeMemberMethod method, Type returnType)
+ {
+ if (returnType != typeof(void))
+ {
+ // create a cast statement
+ CodeCastExpression cce = new CodeCastExpression(
+ returnType,
+ new CodeVariableReferenceExpression(DEFAULT_TEMP)
+ );
+
+ CodeAssignStatement casCast = new CodeAssignStatement();
+ casCast.Left = new CodeVariableReferenceExpression(DEFAULT_RET);
+ casCast.Right = cce;
+
+ method.Statements.Add(casCast);
+
+ // return retVal
+ CodeMethodReturnStatement cmrsCast = new CodeMethodReturnStatement();
+ cmrsCast.Expression = new CodeVariableReferenceExpression(DEFAULT_RET);
+
+ method.Statements.Add(cmrsCast);
+ }
+ else
+ {
+ // construct an undecorated return statement
+ method.Statements.Add(new CodeMethodReturnStatement());
+ }
+ }
+
+
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcProxyGen.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcProxyGen.cs
new file mode 100644
index 0000000..ffb9932
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcProxyGen.cs
@@ -0,0 +1,566 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Collections;
+ using System.Reflection;
+ using System.Reflection.Emit;
+
+ public class XmlRpcProxyGen
+ {
+ static Hashtable _types = new Hashtable();
+
+#if (!FX1_0)
+ public static T Create<T>()
+ {
+ return (T)Create(typeof(T));
+ }
+#endif
+
+ public static object Create(Type itf)
+ {
+ Type proxyType;
+ lock (typeof(XmlRpcProxyGen))
+ {
+ proxyType = (Type)_types[itf];
+ if (proxyType == null)
+ {
+ Guid guid = Guid.NewGuid();
+ string assemblyName = "XmlRpcProxy" + guid.ToString();
+ string moduleName = "XmlRpcProxy" + guid.ToString() + ".dll";
+ string typeName = "XmlRpcProxy" + guid.ToString();
+ AssemblyBuilder assBldr = BuildAssembly(itf, assemblyName,
+ moduleName, typeName);
+ proxyType = assBldr.GetType(typeName);
+ _types.Add(itf, proxyType);
+ }
+ }
+ object ret = Activator.CreateInstance(proxyType);
+ return ret;
+ }
+
+ public static object CreateAssembly(
+ Type itf,
+ string typeName,
+ string assemblyName
+ )
+ {
+ if (assemblyName.IndexOf(".dll") == (assemblyName.Length - 4))
+ assemblyName = assemblyName.Substring(0, assemblyName.Length - 4);
+ string moduleName = assemblyName + ".dll";
+ AssemblyBuilder assBldr = BuildAssembly(itf, assemblyName,
+ moduleName, typeName);
+ Type proxyType = assBldr.GetType(typeName);
+ object ret = Activator.CreateInstance(proxyType);
+ assBldr.Save(moduleName);
+ return ret;
+ }
+
+ static AssemblyBuilder BuildAssembly(
+ Type itf,
+ string assemblyName,
+ string moduleName,
+ string typeName)
+ {
+ string urlString = GetXmlRpcUrl(itf);
+ ArrayList methods = GetXmlRpcMethods(itf);
+ ArrayList beginMethods = GetXmlRpcBeginMethods(itf);
+ ArrayList endMethods = GetXmlRpcEndMethods(itf);
+ AssemblyName assName = new AssemblyName();
+ assName.Name = assemblyName;
+ assName.Version = itf.Assembly.GetName().Version;
+ AssemblyBuilder assBldr = AppDomain.CurrentDomain.DefineDynamicAssembly(
+ assName, AssemblyBuilderAccess.RunAndSave);
+ ModuleBuilder modBldr = assBldr.DefineDynamicModule(assName.Name,
+ moduleName);
+ TypeBuilder typeBldr = modBldr.DefineType(
+ typeName,
+ TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.Public,
+ typeof(XmlRpcClientProtocol),
+ new Type[] { itf });
+ BuildConstructor(typeBldr, typeof(XmlRpcClientProtocol), urlString);
+ BuildMethods(typeBldr, methods);
+ BuildBeginMethods(typeBldr, beginMethods);
+ BuildEndMethods(typeBldr, endMethods);
+ typeBldr.CreateType();
+ return assBldr;
+ }
+
+ static void BuildMethods(TypeBuilder tb, ArrayList methods)
+ {
+ foreach (MethodData mthdData in methods)
+ {
+ MethodInfo mi = mthdData.mi;
+ Type[] argTypes = new Type[mi.GetParameters().Length];
+ for (int i = 0; i < mi.GetParameters().Length; i++)
+ {
+ argTypes[i] = mi.GetParameters()[i].ParameterType;
+ }
+ BuildMethod(tb, mi.Name, mthdData.xmlRpcName, argTypes,
+ mthdData.paramsMethod, mi.ReturnType);
+ }
+ }
+
+ static void BuildMethod(
+ TypeBuilder tb,
+ string methodName,
+ string rpcMethodName,
+ Type[] argTypes,
+ bool paramsMethod,
+ Type returnType)
+ {
+ MethodBuilder mthdBldr = tb.DefineMethod(
+ methodName,
+ MethodAttributes.Public | MethodAttributes.Virtual,
+ returnType, argTypes);
+ // add attribute to method
+ Type[] oneString = new Type[1] { typeof(string) };
+ Type methodAttr = typeof(XmlRpcMethodAttribute);
+ ConstructorInfo ci = methodAttr.GetConstructor(oneString);
+ CustomAttributeBuilder cab =
+ new CustomAttributeBuilder(ci, new object[] { rpcMethodName });
+ mthdBldr.SetCustomAttribute(cab);
+ // possibly add ParamArrayAttribute to final parameter
+ if (paramsMethod)
+ {
+ ParameterBuilder paramBldr = mthdBldr.DefineParameter(argTypes.Length,
+ ParameterAttributes.In, "args");
+ ConstructorInfo ctorInfo = typeof(ParamArrayAttribute).GetConstructor(
+ new Type[0]);
+ CustomAttributeBuilder attrBldr =
+ new CustomAttributeBuilder(ctorInfo, new object[0]);
+ paramBldr.SetCustomAttribute(attrBldr);
+ }
+ // generate IL
+ ILGenerator ilgen = mthdBldr.GetILGenerator();
+ // if non-void return, declared locals for processing return value
+ LocalBuilder retVal = null;
+ LocalBuilder tempRetVal = null;
+ if (typeof(void) != returnType)
+ {
+ tempRetVal = ilgen.DeclareLocal(typeof(System.Object));
+ retVal = ilgen.DeclareLocal(returnType);
+ }
+ // declare variable to store method args and emit code to populate ut
+ LocalBuilder argValues = ilgen.DeclareLocal(typeof(System.Object[]));
+ ilgen.Emit(OpCodes.Ldc_I4, argTypes.Length);
+ ilgen.Emit(OpCodes.Newarr, typeof(System.Object));
+ ilgen.Emit(OpCodes.Stloc, argValues);
+ for (int argLoad = 0; argLoad < argTypes.Length; argLoad++)
+ {
+ ilgen.Emit(OpCodes.Ldloc, argValues);
+ ilgen.Emit(OpCodes.Ldc_I4, argLoad);
+ ilgen.Emit(OpCodes.Ldarg, argLoad + 1);
+ if (argTypes[argLoad].IsValueType)
+ {
+ ilgen.Emit(OpCodes.Box, argTypes[argLoad]);
+ }
+ ilgen.Emit(OpCodes.Stelem_Ref);
+ }
+ // call Invoke on base class
+ Type[] invokeTypes = new Type[] { typeof(MethodInfo), typeof(object[]) };
+ MethodInfo invokeMethod
+ = typeof(XmlRpcClientProtocol).GetMethod("Invoke", invokeTypes);
+ ilgen.Emit(OpCodes.Ldarg_0);
+ ilgen.Emit(OpCodes.Call, typeof(MethodBase).GetMethod("GetCurrentMethod"));
+ ilgen.Emit(OpCodes.Ldloc, argValues);
+ ilgen.Emit(OpCodes.Call, invokeMethod);
+ // if non-void return prepare return value, otherwise pop to discard
+ if (typeof(void) != returnType)
+ {
+ // if return value is null, don't cast it to required type
+ Label retIsNull = ilgen.DefineLabel();
+ ilgen.Emit(OpCodes.Stloc, tempRetVal);
+ ilgen.Emit(OpCodes.Ldloc, tempRetVal);
+ ilgen.Emit(OpCodes.Brfalse, retIsNull);
+ ilgen.Emit(OpCodes.Ldloc, tempRetVal);
+ if (true == returnType.IsValueType)
+ {
+ ilgen.Emit(OpCodes.Unbox, returnType);
+ ilgen.Emit(OpCodes.Ldobj, returnType);
+ }
+ else
+ {
+ ilgen.Emit(OpCodes.Castclass, returnType);
+ }
+ ilgen.Emit(OpCodes.Stloc, retVal);
+ ilgen.MarkLabel(retIsNull);
+ ilgen.Emit(OpCodes.Ldloc, retVal);
+ }
+ else
+ {
+ ilgen.Emit(OpCodes.Pop);
+ }
+ ilgen.Emit(OpCodes.Ret);
+ }
+
+ static void BuildBeginMethods(TypeBuilder tb, ArrayList methods)
+ {
+ foreach (MethodData mthdData in methods)
+ {
+ MethodInfo mi = mthdData.mi;
+ // assume method has already been validated for required signature
+ int paramCount = mi.GetParameters().Length;
+ // argCount counts of params before optional AsyncCallback param
+ int argCount = paramCount;
+ Type[] argTypes = new Type[paramCount];
+ for (int i = 0; i < mi.GetParameters().Length; i++)
+ {
+ argTypes[i] = mi.GetParameters()[i].ParameterType;
+ if (argTypes[i] == typeof(System.AsyncCallback))
+ argCount = i;
+ }
+ MethodBuilder mthdBldr = tb.DefineMethod(
+ mi.Name,
+ MethodAttributes.Public | MethodAttributes.Virtual,
+ mi.ReturnType,
+ argTypes);
+ // add attribute to method
+ Type[] oneString = new Type[1] { typeof(string) };
+ Type methodAttr = typeof(XmlRpcBeginAttribute);
+ ConstructorInfo ci = methodAttr.GetConstructor(oneString);
+ CustomAttributeBuilder cab =
+ new CustomAttributeBuilder(ci, new object[] { mthdData.xmlRpcName });
+ mthdBldr.SetCustomAttribute(cab);
+ // start generating IL
+ ILGenerator ilgen = mthdBldr.GetILGenerator();
+ // declare variable to store method args and emit code to populate it
+ LocalBuilder argValues = ilgen.DeclareLocal(typeof(System.Object[]));
+ ilgen.Emit(OpCodes.Ldc_I4, argCount);
+ ilgen.Emit(OpCodes.Newarr, typeof(System.Object));
+ ilgen.Emit(OpCodes.Stloc, argValues);
+ for (int argLoad = 0; argLoad < argCount; argLoad++)
+ {
+ ilgen.Emit(OpCodes.Ldloc, argValues);
+ ilgen.Emit(OpCodes.Ldc_I4, argLoad);
+ ilgen.Emit(OpCodes.Ldarg, argLoad + 1);
+ ParameterInfo pi = mi.GetParameters()[argLoad];
+ string paramTypeName = pi.ParameterType.AssemblyQualifiedName;
+ paramTypeName = paramTypeName.Replace("&", "");
+ Type paramType = Type.GetType(paramTypeName);
+ if (paramType.IsValueType)
+ {
+ ilgen.Emit(OpCodes.Box, paramType);
+ }
+ ilgen.Emit(OpCodes.Stelem_Ref);
+ }
+ // emit code to store AsyncCallback parameter, defaulting to null
+ // if not in method signature
+ LocalBuilder acbValue = ilgen.DeclareLocal(typeof(System.AsyncCallback));
+ if (argCount < paramCount)
+ {
+ ilgen.Emit(OpCodes.Ldarg, argCount + 1);
+ ilgen.Emit(OpCodes.Stloc, acbValue);
+ }
+ // emit code to store async state parameter, defaulting to null
+ // if not in method signature
+ LocalBuilder objValue = ilgen.DeclareLocal(typeof(System.Object));
+ if (argCount < (paramCount - 1))
+ {
+ ilgen.Emit(OpCodes.Ldarg, argCount + 2);
+ ilgen.Emit(OpCodes.Stloc, objValue);
+ }
+ // emit code to call BeginInvoke on base class
+ Type[] invokeTypes = new Type[]
+ {
+ typeof(MethodInfo),
+ typeof(object[]),
+ typeof(System.Object),
+ typeof(System.AsyncCallback),
+ typeof(System.Object)
+ };
+ MethodInfo invokeMethod
+ = typeof(XmlRpcClientProtocol).GetMethod("BeginInvoke", invokeTypes);
+ ilgen.Emit(OpCodes.Ldarg_0);
+ ilgen.Emit(OpCodes.Call, typeof(MethodBase).GetMethod("GetCurrentMethod"));
+ ilgen.Emit(OpCodes.Ldloc, argValues);
+ ilgen.Emit(OpCodes.Ldarg_0);
+ ilgen.Emit(OpCodes.Ldloc, acbValue);
+ ilgen.Emit(OpCodes.Ldloc, objValue);
+ ilgen.Emit(OpCodes.Call, invokeMethod);
+ // BeginInvoke will leave IAsyncResult on stack - leave it there
+ // for return value from method being built
+ ilgen.Emit(OpCodes.Ret);
+ }
+ }
+
+ static void BuildEndMethods(TypeBuilder tb, ArrayList methods)
+ {
+ LocalBuilder retVal = null;
+ LocalBuilder tempRetVal = null;
+ foreach (MethodData mthdData in methods)
+ {
+ MethodInfo mi = mthdData.mi;
+ Type[] argTypes = new Type[] { typeof(System.IAsyncResult) };
+ MethodBuilder mthdBldr = tb.DefineMethod(mi.Name,
+ MethodAttributes.Public | MethodAttributes.Virtual,
+ mi.ReturnType, argTypes);
+ // start generating IL
+ ILGenerator ilgen = mthdBldr.GetILGenerator();
+ // if non-void return, declared locals for processing return value
+ if (typeof(void) != mi.ReturnType)
+ {
+ tempRetVal = ilgen.DeclareLocal(typeof(System.Object));
+ retVal = ilgen.DeclareLocal(mi.ReturnType);
+ }
+ // call EndInvoke on base class
+ Type[] invokeTypes
+ = new Type[] { typeof(System.IAsyncResult), typeof(System.Type) };
+ MethodInfo invokeMethod
+ = typeof(XmlRpcClientProtocol).GetMethod("EndInvoke", invokeTypes);
+ Type[] GetTypeTypes
+ = new Type[] { typeof(System.String) };
+ MethodInfo GetTypeMethod
+ = typeof(System.Type).GetMethod("GetType", GetTypeTypes);
+ ilgen.Emit(OpCodes.Ldarg_0); // "this"
+ ilgen.Emit(OpCodes.Ldarg_1); // IAsyncResult parameter
+ ilgen.Emit(OpCodes.Ldstr, mi.ReturnType.AssemblyQualifiedName);
+ ilgen.Emit(OpCodes.Call, GetTypeMethod);
+ ilgen.Emit(OpCodes.Call, invokeMethod);
+ // if non-void return prepare return value otherwise pop to discard
+ if (typeof(void) != mi.ReturnType)
+ {
+ // if return value is null, don't cast it to required type
+ Label retIsNull = ilgen.DefineLabel();
+ ilgen.Emit(OpCodes.Stloc, tempRetVal);
+ ilgen.Emit(OpCodes.Ldloc, tempRetVal);
+ ilgen.Emit(OpCodes.Brfalse, retIsNull);
+ ilgen.Emit(OpCodes.Ldloc, tempRetVal);
+ if (true == mi.ReturnType.IsValueType)
+ {
+ ilgen.Emit(OpCodes.Unbox, mi.ReturnType);
+ ilgen.Emit(OpCodes.Ldobj, mi.ReturnType);
+ }
+ else
+ {
+ ilgen.Emit(OpCodes.Castclass, mi.ReturnType);
+ }
+ ilgen.Emit(OpCodes.Stloc, retVal);
+ ilgen.MarkLabel(retIsNull);
+ ilgen.Emit(OpCodes.Ldloc, retVal);
+ }
+ else
+ {
+ // void method so throw away result from EndInvoke
+ ilgen.Emit(OpCodes.Pop);
+ }
+ ilgen.Emit(OpCodes.Ret);
+ }
+ }
+
+ private static void BuildConstructor(
+ TypeBuilder typeBldr,
+ Type baseType,
+ string urlStr)
+ {
+ ConstructorBuilder ctorBldr = typeBldr.DefineConstructor(
+ MethodAttributes.Public | MethodAttributes.SpecialName |
+ MethodAttributes.RTSpecialName | MethodAttributes.HideBySig,
+ CallingConventions.Standard,
+ Type.EmptyTypes);
+ if (urlStr != null && urlStr.Length > 0)
+ {
+ Type urlAttr = typeof(XmlRpcUrlAttribute);
+ Type[] oneString = new Type[1] { typeof(string) };
+ ConstructorInfo ci = urlAttr.GetConstructor(oneString);
+ CustomAttributeBuilder cab =
+ new CustomAttributeBuilder(ci, new object[] { urlStr });
+ typeBldr.SetCustomAttribute(cab);
+ }
+ ILGenerator ilgen = ctorBldr.GetILGenerator();
+ // Call the base constructor.
+ ilgen.Emit(OpCodes.Ldarg_0);
+ ConstructorInfo ctorInfo = baseType.GetConstructor(System.Type.EmptyTypes);
+ ilgen.Emit(OpCodes.Call, ctorInfo);
+ ilgen.Emit(OpCodes.Ret);
+ }
+
+ private static string GetXmlRpcUrl(Type itf)
+ {
+ Attribute attr = Attribute.GetCustomAttribute(itf,
+ typeof(XmlRpcUrlAttribute));
+ if (attr == null)
+ return null;
+ XmlRpcUrlAttribute xruAttr = attr as XmlRpcUrlAttribute;
+ string url = xruAttr.Uri;
+ return url;
+ }
+
+ /// <summary>
+ /// Type.GetMethods() does not return methods that a derived interface
+ /// inherits from its base interfaces; this method does.
+ /// </summary>
+ private static MethodInfo[] GetMethods(Type type)
+ {
+ MethodInfo[] methods = type.GetMethods();
+ if (!type.IsInterface)
+ {
+ return methods;
+ }
+
+ Type[] interfaces = type.GetInterfaces();
+ if (interfaces.Length == 0)
+ {
+ return methods;
+ }
+
+ ArrayList result = new ArrayList(methods);
+ foreach (Type itf in type.GetInterfaces())
+ {
+ result.AddRange(itf.GetMethods());
+ }
+ return (MethodInfo[])result.ToArray(typeof(MethodInfo));
+ }
+
+ private static ArrayList GetXmlRpcMethods(Type itf)
+ {
+ ArrayList ret = new ArrayList();
+ if (!itf.IsInterface)
+ throw new Exception("type not interface");
+ foreach (MethodInfo mi in GetMethods(itf))
+ {
+ string xmlRpcName = GetXmlRpcMethodName(mi);
+ if (xmlRpcName == null)
+ continue;
+ ParameterInfo[] pis = mi.GetParameters();
+ bool paramsMethod = pis.Length > 0 && Attribute.IsDefined(
+ pis[pis.Length - 1], typeof(ParamArrayAttribute));
+ ret.Add(new MethodData(mi, xmlRpcName, paramsMethod));
+ }
+ return ret;
+ }
+
+ private static string GetXmlRpcMethodName(MethodInfo mi)
+ {
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcMethodAttribute));
+ if (attr == null)
+ return null;
+ XmlRpcMethodAttribute xrmAttr = attr as XmlRpcMethodAttribute;
+ string rpcMethod = xrmAttr.Method;
+ if (rpcMethod == "")
+ {
+ rpcMethod = mi.Name;
+ }
+ return rpcMethod;
+ }
+
+ class MethodData
+ {
+ public MethodData(MethodInfo Mi, string XmlRpcName, bool ParamsMethod)
+ {
+ mi = Mi;
+ xmlRpcName = XmlRpcName;
+ paramsMethod = ParamsMethod;
+ returnType = null;
+ }
+ public MethodData(MethodInfo Mi, string XmlRpcName, bool ParamsMethod,
+ Type ReturnType)
+ {
+ mi = Mi;
+ xmlRpcName = XmlRpcName;
+ paramsMethod = ParamsMethod;
+ returnType = ReturnType;
+ }
+ public MethodInfo mi;
+ public string xmlRpcName;
+ public Type returnType;
+ public bool paramsMethod;
+ }
+
+ private static ArrayList GetXmlRpcBeginMethods(Type itf)
+ {
+ ArrayList ret = new ArrayList();
+ if (!itf.IsInterface)
+ throw new Exception("type not interface");
+ foreach (MethodInfo mi in itf.GetMethods())
+ {
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcBeginAttribute));
+ if (attr == null)
+ continue;
+ string rpcMethod = ((XmlRpcBeginAttribute)attr).Method;
+ if (rpcMethod == "")
+ {
+ if (!mi.Name.StartsWith("Begin") || mi.Name.Length <= 5)
+ throw new Exception(String.Format(
+ "method {0} has invalid signature for begin method",
+ mi.Name));
+ rpcMethod = mi.Name.Substring(5);
+ }
+ int paramCount = mi.GetParameters().Length;
+ int i;
+ for (i = 0; i < paramCount; i++)
+ {
+ Type paramType = mi.GetParameters()[0].ParameterType;
+ if (paramType == typeof(System.AsyncCallback))
+ break;
+ }
+ if (paramCount > 1)
+ {
+ if (i < paramCount - 2)
+ throw new Exception(String.Format(
+ "method {0} has invalid signature for begin method", mi.Name));
+ if (i == (paramCount - 2))
+ {
+ Type paramType = mi.GetParameters()[i + 1].ParameterType;
+ if (paramType != typeof(System.Object))
+ throw new Exception(String.Format(
+ "method {0} has invalid signature for begin method",
+ mi.Name));
+ }
+ }
+ ret.Add(new MethodData(mi, rpcMethod, false, null));
+ }
+ return ret;
+ }
+
+ private static ArrayList GetXmlRpcEndMethods(Type itf)
+ {
+ ArrayList ret = new ArrayList();
+ if (!itf.IsInterface)
+ throw new Exception("type not interface");
+ foreach (MethodInfo mi in itf.GetMethods())
+ {
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcEndAttribute));
+ if (attr == null)
+ continue;
+ ParameterInfo[] pis = mi.GetParameters();
+ if (pis.Length != 1)
+ throw new Exception(String.Format(
+ "method {0} has invalid signature for end method", mi.Name));
+ Type paramType = pis[0].ParameterType;
+ if (paramType != typeof(System.IAsyncResult))
+ throw new Exception(String.Format(
+ "method {0} has invalid signature for end method", mi.Name));
+ ret.Add(new MethodData(mi, "", false));
+ }
+ return ret;
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcRequest.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcRequest.cs
new file mode 100644
index 0000000..8b4be9b
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcRequest.cs
@@ -0,0 +1,69 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.IO;
+ using System.Reflection;
+
+ public class XmlRpcRequest
+ {
+ public XmlRpcRequest()
+ {
+ }
+
+ public XmlRpcRequest(string methodName, object[] parameters, MethodInfo methodInfo)
+ {
+ method = methodName;
+ args = parameters;
+ mi = methodInfo;
+ }
+
+ public XmlRpcRequest(string methodName, object[] parameters,
+ MethodInfo methodInfo, string XmlRpcMethod, Guid proxyGuid)
+ {
+ method = methodName;
+ args = parameters;
+ mi = methodInfo;
+ xmlRpcMethod = XmlRpcMethod;
+ proxyId = proxyGuid;
+ }
+
+ public XmlRpcRequest(string methodName, Object[] parameters)
+ {
+ method = methodName;
+ args = parameters;
+ }
+
+ public String method = null;
+ public Object[] args = null;
+ public MethodInfo mi = null;
+ public Guid proxyId;
+ static int _created;
+ public int number = System.Threading.Interlocked.Increment(ref _created);
+ public String xmlRpcMethod = null;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcRequestEventArgs.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcRequestEventArgs.cs
new file mode 100644
index 0000000..60fe950
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcRequestEventArgs.cs
@@ -0,0 +1,59 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.IO;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcRequestEventArgs : EventArgs
+ {
+ private Guid _guid;
+ private long _request;
+ private Stream _requestStream;
+
+ public XmlRpcRequestEventArgs(Guid guid, long request, Stream requestStream)
+ {
+ _guid = guid;
+ _request = request;
+ _requestStream = requestStream;
+ }
+
+ public Guid ProxyID
+ {
+ get { return _guid; }
+ }
+
+ public long RequestNum
+ {
+ get { return _request; }
+ }
+
+ public Stream RequestStream
+ {
+ get { return _requestStream; }
+ }
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcResponse.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcResponse.cs
new file mode 100644
index 0000000..5270117
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcResponse.cs
@@ -0,0 +1,41 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ public class XmlRpcResponse
+ {
+ public XmlRpcResponse()
+ {
+ retVal = null;
+ }
+ public XmlRpcResponse(object retValue)
+ {
+ retVal = retValue;
+ }
+ public Object retVal;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcResponseEventArgs.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcResponseEventArgs.cs
new file mode 100644
index 0000000..6372404
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcResponseEventArgs.cs
@@ -0,0 +1,61 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.IO;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcResponseEventArgs : EventArgs
+ {
+ private Guid _guid;
+ private long _request;
+ private Stream _responseStream;
+
+ public XmlRpcResponseEventArgs(Guid guid, long request,
+ Stream responseStream)
+ {
+ _guid = guid;
+ _request = request;
+ _responseStream = responseStream;
+ }
+
+ public Guid ProxyID
+ {
+ get { return _guid; }
+ }
+
+ public long RequestNum
+ {
+ get { return _request; }
+ }
+
+ public Stream ResponseStream
+ {
+ get { return _responseStream; }
+ }
+ }
+}
+
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcReturnValueAttribute.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcReturnValueAttribute.cs
new file mode 100644
index 0000000..f07707f
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcReturnValueAttribute.cs
@@ -0,0 +1,48 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ [AttributeUsage(AttributeTargets.ReturnValue)]
+ public class XmlRpcReturnValueAttribute : Attribute
+ {
+ public XmlRpcReturnValueAttribute()
+ {
+ }
+ public string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+ public override string ToString()
+ {
+ string value = "Description : " + description;
+ return value;
+ }
+ private string description = "";
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcSerializer.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcSerializer.cs
new file mode 100644
index 0000000..f8788fa
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcSerializer.cs
@@ -0,0 +1,1825 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+// TODO: overriding default mapping action in a struct should not affect nested structs
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Collections;
+ using System.Globalization;
+ using System.IO;
+ using System.Reflection;
+ using System.Text;
+ using System.Text.RegularExpressions;
+ using System.Threading;
+ using System.Xml;
+
+ struct Fault
+ {
+ public int faultCode;
+ public string faultString;
+ }
+
+ public class XmlRpcSerializer
+ {
+ // public properties
+
+ public int Indentation
+ {
+ get { return m_indentation; }
+ set { m_indentation = value; }
+ }
+ int m_indentation = 2;
+
+ public XmlRpcNonStandard NonStandard
+ {
+ get { return m_nonStandard; }
+ set { m_nonStandard = value; }
+ }
+ XmlRpcNonStandard m_nonStandard = XmlRpcNonStandard.None;
+
+ public bool UseIndentation
+ {
+ get { return m_bUseIndentation; }
+ set { m_bUseIndentation = value; }
+ }
+ bool m_bUseIndentation = true;
+
+ public bool UseIntTag
+ {
+ get { return m_useIntTag; }
+ set { m_useIntTag = value; }
+ }
+ bool m_useIntTag;
+
+ public Encoding XmlEncoding
+ {
+ get { return m_encoding; }
+ set { m_encoding = value; }
+ }
+ Encoding m_encoding = null;
+
+ // private properties
+ bool AllowInvalidHTTPContent
+ {
+ get { return (m_nonStandard & XmlRpcNonStandard.AllowInvalidHTTPContent) != 0; }
+ }
+
+ bool AllowNonStandardDateTime
+ {
+ get { return (m_nonStandard & XmlRpcNonStandard.AllowNonStandardDateTime) != 0; }
+ }
+
+ bool AllowStringFaultCode
+ {
+ get { return (m_nonStandard & XmlRpcNonStandard.AllowStringFaultCode) != 0; }
+ }
+
+ bool IgnoreDuplicateMembers
+ {
+ get { return (m_nonStandard & XmlRpcNonStandard.IgnoreDuplicateMembers) != 0; }
+ }
+
+ bool MapEmptyDateTimeToMinValue
+ {
+ get { return (m_nonStandard & XmlRpcNonStandard.MapEmptyDateTimeToMinValue) != 0; }
+ }
+
+ bool MapZerosDateTimeToMinValue
+ {
+ get { return (m_nonStandard & XmlRpcNonStandard.MapZerosDateTimeToMinValue) != 0; }
+ }
+
+ public void SerializeRequest(Stream stm, XmlRpcRequest request)
+ {
+ XmlTextWriter xtw = new XmlTextWriter(stm, m_encoding);
+ ConfigureXmlFormat(xtw);
+ xtw.WriteStartDocument();
+ xtw.WriteStartElement("", "methodCall", "");
+ {
+ ParameterInfo[] pis = null;
+ if (request.mi != null)
+ {
+ pis = request.mi.GetParameters();
+ }
+ // TODO: use global action setting
+ MappingAction mappingAction = MappingAction.Error;
+ if (request.xmlRpcMethod == null)
+ xtw.WriteElementString("methodName", request.method);
+ else
+ xtw.WriteElementString("methodName", request.xmlRpcMethod);
+ xtw.WriteStartElement("", "params", "");
+ try
+ {
+ for (int i=0; i < request.args.Length; i++)
+ {
+ if (pis != null)
+ {
+ if (i >= pis.Length)
+ throw new XmlRpcInvalidParametersException("Number of request "
+ + "parameters greater than number of proxy method parameters.");
+ if (Attribute.IsDefined(pis[i], typeof(ParamArrayAttribute)))
+ {
+ Array ary = (Array)request.args[i];
+ foreach (object o in ary)
+ {
+ if (o == null)
+ throw new XmlRpcNullParameterException(
+ "Null parameter in params array");
+ xtw.WriteStartElement("", "param", "");
+ Serialize(xtw, o, mappingAction);
+ xtw.WriteEndElement();
+ }
+ break;
+ }
+ }
+ if (request.args[i] == null)
+ {
+ throw new XmlRpcNullParameterException(String.Format(
+ "Null method parameter #{0}", i+1));
+ }
+ xtw.WriteStartElement("", "param", "");
+ Serialize(xtw, request.args[i], mappingAction);
+ xtw.WriteEndElement();
+ }
+ }
+ catch (XmlRpcUnsupportedTypeException ex)
+ {
+ throw new XmlRpcUnsupportedTypeException(ex.UnsupportedType,
+ String.Format("A parameter is of, or contains an instance of, "
+ + "type {0} which cannot be mapped to an XML-RPC type",
+ ex.UnsupportedType));
+ }
+ xtw.WriteEndElement();
+ }
+ xtw.WriteEndElement();
+ xtw.Flush();
+ }
+
+#if (!COMPACT_FRAMEWORK)
+ public XmlRpcRequest DeserializeRequest(Stream stm, Type svcType)
+ {
+ if (stm == null)
+ throw new ArgumentNullException("stm",
+ "XmlRpcSerializer.DeserializeRequest");
+ XmlDocument xdoc = new XmlDocument();
+ try
+ {
+ xdoc.Load(stm);
+ }
+ catch (Exception ex)
+ {
+ throw new XmlRpcIllFormedXmlException(
+ "Request from client does not contain valid XML.", ex);
+ }
+ return DeserializeRequest(xdoc, svcType);
+ }
+
+ public XmlRpcRequest DeserializeRequest(TextReader txtrdr, Type svcType)
+ {
+ if (txtrdr == null)
+ throw new ArgumentNullException("txtrdr",
+ "XmlRpcSerializer.DeserializeRequest");
+ XmlDocument xdoc = new XmlDocument();
+ try
+ {
+ xdoc.Load(txtrdr);
+ }
+ catch (Exception ex)
+ {
+ throw new XmlRpcIllFormedXmlException(
+ "Request from client does not contain valid XML.", ex);
+ }
+ return DeserializeRequest(xdoc, svcType);
+ }
+
+ public XmlRpcRequest DeserializeRequest(XmlDocument xdoc, Type svcType)
+ {
+ XmlRpcRequest request = new XmlRpcRequest();
+ XmlNode callNode = SelectSingleNode(xdoc, "methodCall");
+ if (callNode == null)
+ {
+ throw new XmlRpcInvalidXmlRpcException(
+ "Request XML not valid XML-RPC - missing methodCall element.");
+ }
+ XmlNode methodNode = SelectSingleNode(callNode, "methodName");
+ if (methodNode == null)
+ {
+ throw new XmlRpcInvalidXmlRpcException(
+ "Request XML not valid XML-RPC - missing methodName element.");
+ }
+ request.method = methodNode.FirstChild.Value;
+ if (request.method == "")
+ {
+ throw new XmlRpcInvalidXmlRpcException(
+ "Request XML not valid XML-RPC - empty methodName.");
+ }
+ request.mi = null;
+ ParameterInfo[] pis = new ParameterInfo[1];
+ if (svcType != null)
+ {
+ // retrieve info for the method which handles this XML-RPC method
+ XmlRpcServiceInfo svcInfo
+ = XmlRpcServiceInfo.CreateServiceInfo(svcType);
+ request.mi = svcInfo.GetMethodInfo(request.method);
+ // if a service type has been specified and we cannot find the requested
+ // method then we must throw an exception
+ if (request.mi == null)
+ {
+ string msg = String.Format("unsupported method called: {0}",
+ request.method);
+ throw new XmlRpcUnsupportedMethodException(msg);
+ }
+ // method must be marked with XmlRpcMethod attribute
+ Attribute attr = Attribute.GetCustomAttribute(request.mi,
+ typeof(XmlRpcMethodAttribute));
+ if (attr == null)
+ {
+ throw new XmlRpcMethodAttributeException(
+ "Method must be marked with the XmlRpcMethod attribute.");
+ }
+ pis = request.mi.GetParameters();
+ }
+ XmlNode paramsNode = SelectSingleNode(callNode, "params");
+ if (paramsNode == null)
+ {
+ if (svcType != null)
+ {
+ if (pis.Length == 0)
+ {
+ request.args = new object[0];
+ return request;
+ }
+ else
+ {
+ throw new XmlRpcInvalidParametersException(
+ "Method takes parameters and params element is missing.");
+ }
+ }
+ else
+ {
+ request.args = new object[0];
+ return request;
+ }
+ }
+ XmlNodeList paramNodes = paramsNode.ChildNodes;
+ int paramsPos = -1;
+ if (svcType != null && paramNodes.Count != pis.Length)
+ {
+ paramsPos = CheckParameterCount(paramNodes, pis);
+ }
+ ParseStack parseStack = new ParseStack("request");
+ // TODO: use global action setting
+ MappingAction mappingAction = MappingAction.Error;
+ int paramObjCount = (paramsPos == -1 ?paramNodes.Count : paramsPos + 1);
+ Object[] paramObjs = new Object[paramObjCount];
+ // parse ordinary parameters
+ int ordinaryParams = (paramsPos == -1 ?paramNodes.Count :paramsPos);
+ for (int i = 0; i < ordinaryParams; i++)
+ {
+ XmlNode paramNode = paramNodes[i];
+ XmlNode valueNode = paramNode.FirstChild;
+ XmlNode node = valueNode.FirstChild;
+ if (svcType != null)
+ {
+ parseStack.Push(String.Format("parameter {0}", i + 1));
+ // TODO: why following commented out?
+// parseStack.Push(String.Format("parameter {0} mapped to type {1}",
+// i, pis[i].ParameterType.Name));
+ paramObjs[i] = ParseValue(node, pis[i].ParameterType, parseStack,
+ mappingAction);
+ }
+ else
+ {
+ parseStack.Push(String.Format("parameter {0}", i));
+ paramObjs[i] = ParseValue(node, null, parseStack, mappingAction);
+ }
+ parseStack.Pop();
+ }
+ // parse params parameters
+ if (paramsPos != -1)
+ {
+ Type paramsType = pis[paramsPos].ParameterType.GetElementType();
+
+
+ Object[] args = new Object[1];
+ args[0] = paramNodes.Count - paramsPos;
+ Array varargs = (Array)CreateArrayInstance(pis[paramsPos].ParameterType,
+ args);
+ for (int i = 0; i < varargs.Length; i++)
+ {
+ XmlNode paramNode = paramNodes[i + paramsPos];
+ XmlNode valueNode = paramNode.FirstChild;
+ XmlNode node = valueNode.FirstChild;
+ parseStack.Push(String.Format("parameter {0}", i + 1 + paramsPos));
+ varargs.SetValue(ParseValue(node, paramsType, parseStack,
+ mappingAction), i);
+ parseStack.Pop();
+ }
+ paramObjs[paramsPos] = varargs;
+ }
+ request.args = paramObjs;
+ return request;
+ }
+
+ int CheckParameterCount(XmlNodeList paramNodes, ParameterInfo[] pis)
+ {
+ // returns position of params parameter or -1
+ int nodeCount = paramNodes.Count;
+ if (nodeCount == 0 && pis.Length == 0)
+ return -1;
+ if (Attribute.IsDefined(pis[pis.Length - 1], typeof(ParamArrayAttribute)))
+ {
+ // note that params array parameter might have zero items
+ if (nodeCount >= (pis.Length - 1))
+ return pis.Length - 1;
+ }
+ else
+ {
+ if (nodeCount == pis.Length)
+ return -1;
+ }
+ throw new XmlRpcInvalidParametersException(
+ "Method takes parameters and there is incorrect number of param "
+ + "elements.");
+ }
+
+ public void SerializeResponse(Stream stm, XmlRpcResponse response)
+ {
+ Object ret = response.retVal;
+ if (ret is XmlRpcFaultException)
+ {
+ SerializeFaultResponse(stm, (XmlRpcFaultException)ret);
+ return;
+ }
+
+ XmlTextWriter xtw = new XmlTextWriter(stm, m_encoding);
+ ConfigureXmlFormat(xtw);
+ xtw.WriteStartDocument();
+ xtw.WriteStartElement("", "methodResponse", "");
+ xtw.WriteStartElement("", "params", "");
+ // "void" methods actually return an empty string value
+ if (ret == null)
+ {
+ ret = "";
+ }
+ xtw.WriteStartElement("", "param", "");
+ // TODO: use global action setting
+ MappingAction mappingAction = MappingAction.Error;
+ try
+ {
+ Serialize(xtw, ret, mappingAction);
+ }
+ catch (XmlRpcUnsupportedTypeException ex)
+ {
+ throw new XmlRpcInvalidReturnType(string.Format(
+ "Return value is of, or contains an instance of, type {0} which "
+ + "cannot be mapped to an XML-RPC type", ex.UnsupportedType));
+ }
+ xtw.WriteEndElement();
+ xtw.WriteEndElement();
+ xtw.WriteEndElement();
+ xtw.Flush();
+ }
+#endif
+
+ public XmlRpcResponse DeserializeResponse(Stream stm, Type svcType)
+ {
+ if (stm == null)
+ throw new ArgumentNullException("stm",
+ "XmlRpcSerializer.DeserializeResponse");
+ if (AllowInvalidHTTPContent)
+ {
+ Stream newStm = new MemoryStream();
+ Util.CopyStream(stm, newStm);
+ stm = newStm;
+ stm.Position = 0;
+ while (true)
+ {
+ // for now just strip off any leading CR-LF characters
+ int byt = stm.ReadByte();
+ if (byt == -1)
+ throw new XmlRpcIllFormedXmlException(
+ "Response from server does not contain valid XML.");
+ if (byt != 0x0d && byt != 0x0a && byt != ' ' && byt != '\t')
+ {
+ stm.Position = stm.Position - 1;
+ break;
+ }
+ }
+ }
+ XmlDocument xdoc = new XmlDocument();
+ try
+ {
+ xdoc.Load(stm);
+ }
+ catch (Exception ex)
+ {
+ throw new XmlRpcIllFormedXmlException(
+ "Response from server does not contain valid XML.", ex);
+ }
+ return DeserializeResponse(xdoc, svcType);
+ }
+
+ public XmlRpcResponse DeserializeResponse(TextReader txtrdr, Type svcType)
+ {
+ if (txtrdr == null)
+ throw new ArgumentNullException("txtrdr",
+ "XmlRpcSerializer.DeserializeResponse");
+ XmlDocument xdoc = new XmlDocument();
+ try
+ {
+ xdoc.Load(txtrdr);
+ }
+ catch (Exception ex)
+ {
+ throw new XmlRpcIllFormedXmlException(
+ "Response from server does not contain valid XML.", ex);
+ }
+ return DeserializeResponse(xdoc, svcType);
+ }
+
+ public XmlRpcResponse DeserializeResponse(XmlDocument xdoc, Type returnType)
+ {
+ XmlRpcResponse response = new XmlRpcResponse();
+ Object retObj = null;
+ XmlNode methodResponseNode = SelectSingleNode(xdoc, "methodResponse");
+ if (methodResponseNode == null)
+ {
+ throw new XmlRpcInvalidXmlRpcException(
+ "Response XML not valid XML-RPC - missing methodResponse element.");
+ }
+ // check for fault response
+ XmlNode faultNode = SelectSingleNode(methodResponseNode, "fault");
+ if (faultNode != null)
+ {
+ ParseStack parseStack = new ParseStack("fault response");
+ // TODO: use global action setting
+ MappingAction mappingAction = MappingAction.Error;
+ XmlRpcFaultException faultEx = ParseFault(faultNode, parseStack,
+ mappingAction);
+ throw faultEx;
+ }
+ XmlNode paramsNode = SelectSingleNode(methodResponseNode, "params");
+ if (paramsNode == null && returnType != null)
+ {
+ if (returnType == typeof(void))
+ return null;
+ else
+ throw new XmlRpcInvalidXmlRpcException(
+ "Response XML not valid XML-RPC - missing params element.");
+ }
+ XmlNode paramNode = SelectSingleNode(paramsNode, "param"); // TODO: verify single params node?
+ if (paramNode == null && returnType != null)
+ {
+ if (returnType == typeof(void))
+ return null;
+ else
+ throw new XmlRpcInvalidXmlRpcException(
+ "Response XML not valid XML-RPC - missing params element.");
+ }
+ XmlNode valueNode = SelectSingleNode(paramNode, "value");
+ if (valueNode == null)
+ {
+ throw new XmlRpcInvalidXmlRpcException(
+ "Response XML not valid XML-RPC - missing value element.");
+ }
+ if (returnType == typeof(void))
+ {
+ retObj = null;
+ }
+ else
+ {
+ ParseStack parseStack = new ParseStack("response");
+ // TODO: use global action setting
+ MappingAction mappingAction = MappingAction.Error;
+ XmlNode node = valueNode.FirstChild;
+ retObj = ParseValue(node, returnType, parseStack, mappingAction);
+ }
+ response.retVal = retObj;
+ return response;
+ }
+
+ //#if (DEBUG)
+ public
+ //#endif
+ void Serialize(
+ XmlTextWriter xtw,
+ Object o,
+ MappingAction mappingAction)
+ {
+ Serialize(xtw, o, mappingAction, new ArrayList(16));
+ }
+
+ //#if (DEBUG)
+ public
+ //#endif
+ void Serialize(
+ XmlTextWriter xtw,
+ Object o,
+ MappingAction mappingAction,
+ ArrayList nestedObjs)
+ {
+ if (nestedObjs.Contains(o))
+ throw new XmlRpcUnsupportedTypeException(nestedObjs[0].GetType(),
+ "Cannot serialize recursive data structure");
+ nestedObjs.Add(o);
+ try
+ {
+ xtw.WriteStartElement("", "value", "");
+ XmlRpcType xType = XmlRpcServiceInfo.GetXmlRpcType(o.GetType());
+ if (xType == XmlRpcType.tArray)
+ {
+ xtw.WriteStartElement("", "array", "");
+ xtw.WriteStartElement("", "data", "");
+ Array a = (Array) o;
+ foreach (Object aobj in a)
+ {
+ if (aobj == null)
+ throw new XmlRpcMappingSerializeException(String.Format(
+ "Items in array cannot be null ({0}[]).",
+ o.GetType().GetElementType()));
+ Serialize(xtw, aobj, mappingAction, nestedObjs);
+ }
+ xtw.WriteEndElement();
+ xtw.WriteEndElement();
+ }
+ else if (xType == XmlRpcType.tMultiDimArray)
+ {
+ Array mda = (Array)o;
+ int[] indices = new int[mda.Rank];
+ BuildArrayXml(xtw, mda, 0, indices, mappingAction, nestedObjs);
+ }
+ else if (xType == XmlRpcType.tBase64)
+ {
+ byte[] buf = (byte[])o;
+ xtw.WriteStartElement("", "base64", "");
+ xtw.WriteBase64(buf, 0, buf.Length);
+ xtw.WriteEndElement();
+ }
+ else if (xType == XmlRpcType.tBoolean)
+ {
+ bool boolVal;
+ if (o is bool)
+ boolVal = (bool)o;
+ else
+ boolVal = (bool)(XmlRpcBoolean)o;
+ if (boolVal)
+ xtw.WriteElementString("boolean", "1");
+ else
+ xtw.WriteElementString("boolean", "0");
+ }
+ else if (xType == XmlRpcType.tDateTime)
+ {
+ DateTime dt;
+ if (o is DateTime)
+ dt = (DateTime)o;
+ else
+ dt = (XmlRpcDateTime)o;
+ string sdt = dt.ToString("yyyyMMdd'T'HH':'mm':'ss",
+ DateTimeFormatInfo.InvariantInfo);
+ xtw.WriteElementString("dateTime.iso8601", sdt);
+ }
+ else if (xType == XmlRpcType.tDouble)
+ {
+ double doubleVal;
+ if (o is double)
+ doubleVal = (double)o;
+ else
+ doubleVal = (XmlRpcDouble)o;
+ xtw.WriteElementString("double", doubleVal.ToString(null,
+ CultureInfo.InvariantCulture));
+ }
+ else if (xType == XmlRpcType.tHashtable)
+ {
+ xtw.WriteStartElement("", "struct", "");
+ XmlRpcStruct xrs = o as XmlRpcStruct;
+ foreach (object obj in xrs.Keys)
+ {
+ string skey = obj as string;
+ xtw.WriteStartElement("", "member", "");
+ xtw.WriteElementString("name", skey);
+ Serialize(xtw, xrs[skey], mappingAction, nestedObjs);
+ xtw.WriteEndElement();
+ }
+ xtw.WriteEndElement();
+ }
+ else if (xType == XmlRpcType.tInt32)
+ {
+ if (UseIntTag)
+ xtw.WriteElementString("int", o.ToString());
+ else
+ xtw.WriteElementString("i4", o.ToString());
+ }
+ else if (xType == XmlRpcType.tString)
+ {
+ xtw.WriteElementString("string", (string)o);
+ }
+ else if (xType == XmlRpcType.tStruct)
+ {
+ MappingAction structAction
+ = StructMappingAction(o.GetType(), mappingAction);
+ xtw.WriteStartElement("", "struct", "");
+ MemberInfo[] mis = o.GetType().GetMembers();
+ foreach (MemberInfo mi in mis)
+ {
+ if (mi.MemberType == MemberTypes.Field)
+ {
+ FieldInfo fi = (FieldInfo)mi;
+ string member = fi.Name;
+ Attribute attrchk = Attribute.GetCustomAttribute(fi,
+ typeof(XmlRpcMemberAttribute));
+ if (attrchk != null && attrchk is XmlRpcMemberAttribute)
+ {
+ string mmbr = ((XmlRpcMemberAttribute)attrchk).Member;
+ if (mmbr != "")
+ member = mmbr;
+ }
+ if (fi.GetValue(o) == null)
+ {
+ MappingAction memberAction = MemberMappingAction(o.GetType(),
+ fi.Name, structAction);
+ if (memberAction == MappingAction.Ignore)
+ continue;
+ throw new XmlRpcMappingSerializeException(@"Member """ + member +
+ @""" of struct """ + o.GetType().Name + @""" cannot be null.");
+ }
+ xtw.WriteStartElement("", "member", "");
+ xtw.WriteElementString("name", member);
+ Serialize(xtw, fi.GetValue(o), mappingAction, nestedObjs);
+ xtw.WriteEndElement();
+ }
+ else if (mi.MemberType == MemberTypes.Property)
+ {
+ PropertyInfo pi = (PropertyInfo)mi;
+ string member = pi.Name;
+ Attribute attrchk = Attribute.GetCustomAttribute(pi,
+ typeof(XmlRpcMemberAttribute));
+ if (attrchk != null && attrchk is XmlRpcMemberAttribute)
+ {
+ string mmbr = ((XmlRpcMemberAttribute)attrchk).Member;
+ if (mmbr != "")
+ member = mmbr;
+ }
+ if (pi.GetValue(o, null) == null)
+ {
+ MappingAction memberAction = MemberMappingAction(o.GetType(),
+ pi.Name, structAction);
+ if (memberAction == MappingAction.Ignore)
+ continue;
+ }
+ xtw.WriteStartElement("", "member", "");
+ xtw.WriteElementString("name", member);
+ Serialize(xtw, pi.GetValue(o, null), mappingAction, nestedObjs);
+ xtw.WriteEndElement();
+ }
+ }
+ xtw.WriteEndElement();
+ }
+ else if (xType == XmlRpcType.tVoid)
+ xtw.WriteElementString("string", "");
+ else
+ throw new XmlRpcUnsupportedTypeException(o.GetType());
+ xtw.WriteEndElement();
+ }
+ catch(System.NullReferenceException)
+ {
+ throw new XmlRpcNullReferenceException("Attempt to serialize data "
+ + "containing null reference");
+ }
+ finally
+ {
+ nestedObjs.RemoveAt(nestedObjs.Count - 1);
+ }
+ }
+
+ void BuildArrayXml(
+ XmlTextWriter xtw,
+ Array ary,
+ int CurRank,
+ int[] indices,
+ MappingAction mappingAction,
+ ArrayList nestedObjs)
+ {
+ xtw.WriteStartElement("", "array", "");
+ xtw.WriteStartElement("", "data", "");
+ if (CurRank < (ary.Rank-1))
+ {
+ for (int i=0; i<ary.GetLength(CurRank); i++)
+ {
+ indices[CurRank] = i;
+ xtw.WriteStartElement("", "value", "");
+ BuildArrayXml(xtw, ary, CurRank+1, indices, mappingAction, nestedObjs);
+ xtw.WriteEndElement();
+ }
+ }
+ else
+ {
+ for (int i=0; i<ary.GetLength(CurRank); i++)
+ {
+ indices[CurRank] = i;
+ Serialize(xtw, ary.GetValue(indices), mappingAction, nestedObjs);
+ }
+ }
+ xtw.WriteEndElement();
+ xtw.WriteEndElement();
+ }
+
+ Object ParseValue(
+ XmlNode node,
+ Type ValueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ Type parsedType;
+ Type parsedArrayType;
+ return ParseValue(node, ValueType, parseStack, mappingAction,
+ out parsedType, out parsedArrayType);
+ }
+
+ //#if (DEBUG)
+ public
+ //#endif
+ Object ParseValue(
+ XmlNode node,
+ Type ValueType,
+ ParseStack parseStack,
+ MappingAction mappingAction,
+ out Type ParsedType,
+ out Type ParsedArrayType)
+ {
+ ParsedType = null;
+ ParsedArrayType = null;
+ // if suppplied type is System.Object then ignore it because
+ // if doesn't provide any useful information (parsing methods
+ // expect null in this case)
+ Type valType = ValueType;
+ if (valType != null && valType.BaseType == null)
+ valType = null;
+
+ Object retObj = null;
+ if (node == null)
+ {
+ retObj = "";
+ }
+ else if (node is XmlText)
+ {
+ if (valType != null && valType != typeof(string))
+ {
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType
+ + " contains implicit string value where "
+ + XmlRpcServiceInfo.GetXmlRpcTypeString(valType)
+ + " expected " + StackDump(parseStack));
+ }
+ retObj = node.Value;
+ }
+ else
+ {
+ if (node.Name == "array")
+ retObj = ParseArray(node, valType, parseStack, mappingAction);
+ else if (node.Name == "base64")
+ retObj = ParseBase64(node, valType, parseStack, mappingAction);
+ else if (node.Name == "struct")
+ {
+ // if we don't know the expected struct type then we must
+ // parse the XML-RPC struct as an instance of XmlRpcStruct
+ if (valType != null && valType != typeof(XmlRpcStruct)
+ && !valType.IsSubclassOf(typeof(XmlRpcStruct)))
+ {
+ retObj = ParseStruct(node, valType, parseStack, mappingAction);
+ }
+ else
+ {
+ if (valType == null || valType == typeof(object))
+ valType = typeof(XmlRpcStruct);
+ // TODO: do we need to validate type here?
+ retObj = ParseHashtable(node, valType, parseStack, mappingAction);
+ }
+ }
+ else if (node.Name == "i4" // integer has two representations in XML-RPC spec
+ || node.Name == "int")
+ {
+ retObj = ParseInt(node, valType, parseStack, mappingAction);
+ ParsedType = typeof(int);
+ ParsedArrayType = typeof(int[]);
+ }
+ else if (node.Name == "string")
+ {
+ retObj = ParseString(node, valType, parseStack, mappingAction);
+ ParsedType = typeof(string);
+ ParsedArrayType = typeof(string[]);
+ }
+ else if (node.Name == "boolean")
+ {
+ retObj = ParseBoolean(node, valType, parseStack, mappingAction);
+ ParsedType = typeof(bool);
+ ParsedArrayType = typeof(bool[]);
+ }
+ else if (node.Name == "double")
+ {
+ retObj = ParseDouble(node, valType, parseStack, mappingAction);
+ ParsedType = typeof(double);
+ ParsedArrayType = typeof(double[]);
+ }
+ else if (node.Name == "dateTime.iso8601")
+ {
+ retObj = ParseDateTime(node, valType, parseStack, mappingAction);
+ ParsedType = typeof(DateTime);
+ ParsedArrayType = typeof(DateTime[]);
+ }
+ }
+ return retObj;
+ }
+
+ Object ParseArray(
+ XmlNode node,
+ Type ValueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ // required type must be an array
+ if (ValueType != null
+ && !(ValueType.IsArray == true
+ || ValueType == typeof(Array)
+ || ValueType == typeof(object)))
+ {
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType
+ + " contains array value where "
+ + XmlRpcServiceInfo.GetXmlRpcTypeString(ValueType)
+ + " expected " + StackDump(parseStack));
+ }
+ if (ValueType != null)
+ {
+ XmlRpcType xmlRpcType = XmlRpcServiceInfo.GetXmlRpcType(ValueType);
+ if (xmlRpcType == XmlRpcType.tMultiDimArray)
+ {
+ parseStack.Push("array mapped to type " + ValueType.Name);
+ Object ret = ParseMultiDimArray(node, ValueType, parseStack,
+ mappingAction);
+ return ret;
+ }
+ parseStack.Push("array mapped to type " + ValueType.Name);
+ }
+ else
+ parseStack.Push("array");
+ XmlNode dataNode = SelectSingleNode(node, "data");
+ int nodeCount = dataNode.ChildNodes.Count;
+ Object[] elements = new Object[nodeCount];
+ // determine type of array elements
+ Type elemType = null;
+ if (ValueType != null
+ && ValueType != typeof(Array)
+ && ValueType != typeof(object))
+ {
+#if (!COMPACT_FRAMEWORK)
+ elemType = ValueType.GetElementType();
+#else
+ string[] checkMultiDim = Regex.Split(ValueType.FullName,
+ "\\[\\]$");
+ // determine assembly of array element type
+ Assembly asmbly = ValueType.Assembly;
+ string[] asmblyName = asmbly.FullName.Split(',');
+ string elemTypeName = checkMultiDim[0] + ", " + asmblyName[0];
+ elemType = Type.GetType(elemTypeName);
+#endif
+ }
+ else
+ {
+ elemType = typeof(object);
+ }
+ bool bGotType = false;
+ Type useType = null;
+ int i = 0;
+ foreach (XmlNode vNode in dataNode.ChildNodes)
+ {
+ parseStack.Push(String.Format("element {0}", i));
+ XmlNode vvNode = vNode.FirstChild;
+ Type parsedType;
+ Type parsedArrayType;
+ elements[i++] = ParseValue(vvNode, elemType, parseStack, mappingAction,
+ out parsedType, out parsedArrayType);
+ if (bGotType == false)
+ {
+ useType = parsedArrayType;
+ bGotType = true;
+ }
+ else
+ {
+ if (useType != parsedArrayType)
+ useType = null;
+ }
+ parseStack.Pop();
+ }
+ Object[] args = new Object[1]; args[0] = nodeCount;
+ Object retObj = null;
+ if (ValueType != null
+ && ValueType != typeof(Array)
+ && ValueType != typeof(object))
+ {
+ retObj = CreateArrayInstance(ValueType, args);
+ }
+ else
+ {
+ if (useType == null)
+ retObj = CreateArrayInstance(typeof(object[]), args);
+ else
+ retObj = CreateArrayInstance(useType, args);
+ }
+ for (int j=0; j < elements.Length; j++)
+ {
+ ((Array)retObj).SetValue(elements[j], j);
+ }
+ parseStack.Pop();
+ return retObj;
+ }
+
+ Object ParseMultiDimArray(XmlNode node, Type ValueType,
+ ParseStack parseStack, MappingAction mappingAction)
+ {
+ // parse the type name to get element type and array rank
+#if (!COMPACT_FRAMEWORK)
+ Type elemType = ValueType.GetElementType();
+ int rank = ValueType.GetArrayRank();
+#else
+ string[] checkMultiDim = Regex.Split(ValueType.FullName,
+ "\\[,[,]*\\]$");
+ Type elemType = Type.GetType(checkMultiDim[0]);
+ string commas = ValueType.FullName.Substring(checkMultiDim[0].Length+1,
+ ValueType.FullName.Length-checkMultiDim[0].Length-2);
+ int rank = commas.Length+1;
+#endif
+ // elements will be stored sequentially as nested arrays are parsed
+ ArrayList elements = new ArrayList();
+ // create array to store length of each dimension - initialize to
+ // all zeroes so that when parsing we can determine if an array for
+ // that dimension has been parsed already
+ int[] dimLengths = new int[rank];
+ dimLengths.Initialize();
+ ParseMultiDimElements(node, rank, 0, elemType, elements, dimLengths,
+ parseStack, mappingAction);
+ // build arguments to define array dimensions and create the array
+ Object[] args = new Object[dimLengths.Length];
+ for (int argi=0; argi<dimLengths.Length; argi++)
+ {
+ args[argi] = dimLengths[argi];
+ }
+ Array ret = (Array)CreateArrayInstance(ValueType, args);
+ // copy elements into new multi-dim array
+ //!! make more efficient
+ int length = ret.Length;
+ for (int e=0; e<length; e++)
+ {
+ int[] indices = new int[dimLengths.Length];
+ int div = 1;
+ for (int f=(indices.Length-1); f>=0; f--)
+ {
+ indices[f] = (e/div)%dimLengths[f];
+ div*=dimLengths[f];
+ }
+ ret.SetValue(elements[e], indices);
+ }
+ return ret;
+ }
+
+ void ParseMultiDimElements(XmlNode node, int Rank, int CurRank,
+ Type elemType, ArrayList elements, int[] dimLengths,
+ ParseStack parseStack, MappingAction mappingAction)
+ {
+ if (node.Name != "array")
+ {
+ throw new XmlRpcTypeMismatchException(
+ "param element does not contain array element.");
+ }
+ XmlNode dataNode = SelectSingleNode(node, "data");
+ int nodeCount = dataNode.ChildNodes.Count;
+ //!! check that multi dim array is not jagged
+ if (dimLengths[CurRank] != 0 && nodeCount != dimLengths[CurRank])
+ {
+ throw new XmlRpcNonRegularArrayException(
+ "Multi-dimensional array must not be jagged.");
+ }
+ dimLengths[CurRank] = nodeCount; // in case first array at this rank
+ if (CurRank < (Rank-1))
+ {
+ foreach (XmlNode vNode in dataNode.ChildNodes)
+ {
+ XmlNode arrayNode = SelectSingleNode(vNode, "array");
+ ParseMultiDimElements(arrayNode, Rank, CurRank+1, elemType,
+ elements, dimLengths, parseStack, mappingAction);
+ }
+ }
+ else
+ {
+ foreach (XmlNode vNode in dataNode.ChildNodes)
+ {
+ XmlNode vvNode = vNode.FirstChild;
+ elements.Add(ParseValue(vvNode, elemType, parseStack,
+ mappingAction));
+ }
+ }
+ }
+
+ Object ParseStruct(
+ XmlNode node,
+ Type valueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ if (valueType.IsPrimitive)
+ {
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType
+ + " contains struct value where "
+ + XmlRpcServiceInfo.GetXmlRpcTypeString(valueType)
+ + " expected " + StackDump(parseStack));
+ }
+#if !FX1_0
+ if (valueType.IsGenericType
+ && valueType.GetGenericTypeDefinition() == typeof(Nullable<>))
+ {
+ valueType = valueType.GetGenericArguments()[0];
+ }
+#endif
+ // Note: mapping action on a struct is only applied locally - it
+ // does not override the global mapping action when members of the
+ // struct are parsed
+ MappingAction localAction = mappingAction;
+ if (valueType != null)
+ {
+ parseStack.Push("struct mapped to type " + valueType.Name);
+ localAction = StructMappingAction(valueType, mappingAction);
+ }
+ else
+ {
+ parseStack.Push("struct");
+ }
+ // create map of field names and remove each name from it as
+ // processed so we can determine which fields are missing
+ // TODO: replace HashTable with lighter collection
+ Hashtable names = new Hashtable();
+ foreach (FieldInfo fi in valueType.GetFields())
+ {
+ names.Add(fi.Name, fi.Name);
+ }
+ foreach (PropertyInfo pi in valueType.GetProperties())
+ {
+ names.Add(pi.Name, pi.Name);
+ }
+ XmlNodeList members = node.ChildNodes;
+ Object retObj = Activator.CreateInstance(valueType);
+ int fieldCount = 0;
+ foreach (XmlNode member in members)
+ {
+ if (member.Name != "member")
+ continue;
+ XmlNode nameNode;
+ bool dupName;
+ XmlNode valueNode;
+ bool dupValue;
+ SelectTwoNodes(member, "name", out nameNode, out dupName, "value",
+ out valueNode, out dupValue);
+ if (nameNode == null)
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains a member with missing name element"
+ + " " + StackDump(parseStack));
+ if (dupName)
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains member with more than one name element"
+ + " " + StackDump(parseStack));
+ string name = nameNode.FirstChild.Value;
+ if (valueNode == null)
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains struct member " + name + " with missing value "
+ + " " + StackDump(parseStack));
+ if (dupValue)
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains member with more than one value element"
+ + " " + StackDump(parseStack));
+ string structName = GetStructName(valueType, name);
+ if (structName != null)
+ name = structName;
+ if (names.Contains(name))
+ names.Remove(name);
+ else
+ {
+ if (!IgnoreDuplicateMembers
+ && (valueType.GetField(name) != null || valueType.GetProperty(name) != null))
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains struct value with duplicate member "
+ + nameNode.FirstChild.Value
+ + " " + StackDump(parseStack));
+ else
+ continue; // ignore duplicate member
+ }
+ MemberInfo[] mis = valueType.GetMember(name);
+ if (mis.Length == 0)
+ {
+ continue; // allow unexpected members
+ }
+ Object valObj = null;
+ switch (mis[0].MemberType)
+ {
+ case MemberTypes.Field:
+ FieldInfo fi = (FieldInfo)mis[0];
+ if (valueType == null)
+ parseStack.Push(String.Format("member {0}", name));
+ else
+ parseStack.Push(String.Format("member {0} mapped to type {1}",
+ name,fi.FieldType.Name));
+ try
+ {
+ valObj = ParseValue(valueNode.FirstChild, fi.FieldType,
+ parseStack, mappingAction);
+ }
+ catch(XmlRpcInvalidXmlRpcException)
+ {
+ if (valueType != null && localAction == MappingAction.Error)
+ {
+ MappingAction memberAction = MemberMappingAction(valueType,
+ name, MappingAction.Error);
+ if (memberAction == MappingAction.Error)
+ throw;
+ }
+ }
+ finally
+ {
+ parseStack.Pop();
+ }
+ fi.SetValue(retObj, valObj);
+ break ;
+ case MemberTypes.Property :
+ PropertyInfo pi = (PropertyInfo)mis[0] ;
+ if (valueType == null)
+ parseStack.Push(String.Format("member {0}", name));
+ else
+
+ parseStack.Push(String.Format("member {0} mapped to type {1}",
+ name,pi.PropertyType.Name));
+ valObj = ParseValue(valueNode.FirstChild, pi.PropertyType,
+ parseStack, mappingAction);
+ parseStack.Pop();
+
+ pi.SetValue(retObj, valObj, null);
+ break ;
+ }
+ fieldCount++;
+ }
+ if (localAction == MappingAction.Error && names.Count > 0)
+ ReportMissingMembers(valueType, names, parseStack);
+ parseStack.Pop();
+ return retObj;
+ }
+
+ void ReportMissingMembers(
+ Type valueType,
+ Hashtable names,
+ ParseStack parseStack)
+ {
+ StringBuilder sb = new StringBuilder();
+ int errorCount = 0;
+ string sep = "";
+ foreach (string s in names.Keys)
+ {
+ MappingAction memberAction = MemberMappingAction(valueType, s,
+ MappingAction.Error);
+ if (memberAction == MappingAction.Error)
+ {
+ sb.Append(sep);
+ sb.Append(s);
+ sep = " ";
+ errorCount++;
+ }
+ }
+ if (errorCount > 0)
+ {
+ string plural = "";
+ if (errorCount > 1)
+ plural = "s";
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType
+ + " contains struct value with missing non-optional member"
+ + plural + ": " + sb.ToString() + " " + StackDump(parseStack));
+ }
+ }
+
+ string GetStructName(Type ValueType, string XmlRpcName)
+ {
+ // given a member name in an XML-RPC struct, check to see whether
+ // a field has been associated with this XML-RPC member name, return
+ // the field name if it has else return null
+ if (ValueType == null)
+ return null;
+ foreach (FieldInfo fi in ValueType.GetFields())
+ {
+ Attribute attr = Attribute.GetCustomAttribute(fi,
+ typeof(XmlRpcMemberAttribute));
+ if (attr != null
+ && attr is XmlRpcMemberAttribute
+ && ((XmlRpcMemberAttribute)attr).Member == XmlRpcName)
+ {
+ string ret = fi.Name;
+ return ret;
+ }
+ }
+ return null;
+ }
+
+ MappingAction StructMappingAction(
+ Type type,
+ MappingAction currentAction)
+ {
+ // if struct member has mapping action attribute, override the current
+ // mapping action else just return the current action
+ if (type == null)
+ return currentAction;
+ Attribute attr = Attribute.GetCustomAttribute(type,
+ typeof(XmlRpcMissingMappingAttribute));
+ if (attr != null)
+ return ((XmlRpcMissingMappingAttribute)attr).Action;
+ return currentAction;
+ }
+
+ MappingAction MemberMappingAction(
+ Type type,
+ string memberName,
+ MappingAction currentAction)
+ {
+ // if struct member has mapping action attribute, override the current
+ // mapping action else just return the current action
+ if (type == null)
+ return currentAction;
+ Attribute attr = null;
+ FieldInfo fi = type.GetField(memberName);
+ if (fi != null)
+ attr = Attribute.GetCustomAttribute(fi,
+ typeof(XmlRpcMissingMappingAttribute));
+ else
+ {
+ PropertyInfo pi = type.GetProperty(memberName);
+ attr = Attribute.GetCustomAttribute(pi,
+ typeof(XmlRpcMissingMappingAttribute));
+ }
+ if (attr != null)
+ return ((XmlRpcMissingMappingAttribute)attr).Action;
+ return currentAction;
+ }
+
+ Object ParseHashtable(
+ XmlNode node,
+ Type valueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ XmlRpcStruct retObj = new XmlRpcStruct();
+ parseStack.Push("struct mapped to XmlRpcStruct");
+ try
+ {
+ XmlNodeList members = node.ChildNodes;
+ foreach (XmlNode member in members)
+ {
+ if (member.Name != "member")
+ continue;
+ XmlNode nameNode;
+ bool dupName;
+ XmlNode valueNode;
+ bool dupValue;
+ SelectTwoNodes(member, "name", out nameNode, out dupName, "value",
+ out valueNode, out dupValue);
+ if (nameNode == null)
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains a member with missing name element"
+ + " " + StackDump(parseStack));
+ if (dupName)
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains member with more than one name element"
+ + " " + StackDump(parseStack));
+ string rpcName = nameNode.FirstChild.Value;
+ if (valueNode == null)
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains struct member " + rpcName + " with missing value "
+ + " " + StackDump(parseStack));
+ if (dupValue)
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains member with more than one value element"
+ + " " + StackDump(parseStack));
+ if (retObj.Contains(rpcName))
+ {
+ if (!IgnoreDuplicateMembers)
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains struct value with duplicate member "
+ + nameNode.FirstChild.Value
+ + " " + StackDump(parseStack));
+ else
+ continue;
+ }
+ object valObj;
+ parseStack.Push(String.Format("member {0}", rpcName));
+ try
+ {
+ valObj = ParseValue(valueNode.FirstChild, null, parseStack,
+ mappingAction);
+ }
+ finally
+ {
+ parseStack.Pop();
+ }
+ retObj.Add(rpcName, valObj);
+ }
+ }
+ finally
+ {
+ parseStack.Pop();
+ }
+ return retObj;
+ }
+
+ Object ParseInt(
+ XmlNode node,
+ Type ValueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ if (ValueType != null && ValueType != typeof(Object)
+ && ValueType != typeof(System.Int32)
+#if !FX1_0
+ && ValueType != typeof(int?)
+#endif
+ && ValueType != typeof(XmlRpcInt))
+ {
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType +
+ " contains int value where "
+ + XmlRpcServiceInfo.GetXmlRpcTypeString(ValueType)
+ + " expected " + StackDump(parseStack));
+ }
+ int retVal;
+ parseStack.Push("integer");
+ try
+ {
+ XmlNode valueNode = node.FirstChild;
+ if (valueNode == null)
+ {
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ +" contains invalid int element " + StackDump(parseStack));
+ }
+ try
+ {
+ String strValue = valueNode.Value;
+ retVal = Int32.Parse(strValue);
+ }
+ catch(Exception)
+ {
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains invalid int value " + StackDump(parseStack));
+ }
+ }
+ finally
+ {
+ parseStack.Pop();
+ }
+ if (ValueType == typeof(XmlRpcInt))
+ return new XmlRpcInt(retVal);
+ else
+ return retVal;
+ }
+
+ Object ParseString(
+ XmlNode node,
+ Type ValueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ if (ValueType != null && ValueType != typeof(System.String)
+ && ValueType != typeof(Object))
+ {
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType
+ + " contains string value where "
+ + XmlRpcServiceInfo.GetXmlRpcTypeString(ValueType)
+ + " expected " + StackDump(parseStack));
+ }
+ string ret;
+ parseStack.Push("string");
+ try
+ {
+ if (node.FirstChild == null)
+ ret = "";
+ else
+ ret = node.FirstChild.Value;
+ }
+ finally
+ {
+ parseStack.Pop();
+ }
+ return ret;
+ }
+
+ Object ParseBoolean(
+ XmlNode node,
+ Type ValueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ if (ValueType != null && ValueType != typeof(Object)
+ && ValueType != typeof(System.Boolean)
+#if !FX1_0
+ && ValueType != typeof(bool?)
+#endif
+ && ValueType != typeof(XmlRpcBoolean))
+ {
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType
+ + " contains boolean value where "
+ + XmlRpcServiceInfo.GetXmlRpcTypeString(ValueType)
+ + " expected " + StackDump(parseStack));
+ }
+ bool retVal;
+ parseStack.Push("boolean");
+ try
+ {
+ string s = node.FirstChild.Value;
+ if (s == "1")
+ {
+ retVal = true;
+ }
+ else if (s == "0")
+ {
+ retVal = false;
+ }
+ else
+ {
+ throw new XmlRpcInvalidXmlRpcException(
+ "reponse contains invalid boolean value "
+ + StackDump(parseStack));
+ }
+ }
+ finally
+ {
+ parseStack.Pop();
+ }
+ if (ValueType == typeof(XmlRpcBoolean))
+ return new XmlRpcBoolean(retVal);
+ else
+ return retVal;
+ }
+
+ Object ParseDouble(
+ XmlNode node,
+ Type ValueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ if (ValueType != null && ValueType != typeof(Object)
+ && ValueType != typeof(System.Double)
+#if !FX1_0
+ && ValueType != typeof(double?)
+#endif
+ && ValueType != typeof(XmlRpcDouble))
+ {
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType
+ + " contains double value where "
+ + XmlRpcServiceInfo.GetXmlRpcTypeString(ValueType)
+ + " expected " + StackDump(parseStack));
+ }
+ Double retVal;
+ parseStack.Push("double");
+ try
+ {
+ retVal = Double.Parse(node.FirstChild.Value,
+ CultureInfo.InvariantCulture.NumberFormat);
+ }
+ catch(Exception)
+ {
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains invalid double value " + StackDump(parseStack));
+ }
+ finally
+ {
+ parseStack.Pop();
+ }
+ if (ValueType == typeof(XmlRpcDouble))
+ return new XmlRpcDouble(retVal);
+ else
+ return retVal;
+ }
+
+ Object ParseDateTime(
+ XmlNode node,
+ Type ValueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ if (ValueType != null && ValueType != typeof(Object)
+ && ValueType != typeof(System.DateTime)
+#if !FX1_0
+ && ValueType != typeof(DateTime?)
+#endif
+ && ValueType != typeof(XmlRpcDateTime))
+ {
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType
+ + " contains dateTime.iso8601 value where "
+ + XmlRpcServiceInfo.GetXmlRpcTypeString(ValueType)
+ + " expected " + StackDump(parseStack));
+ }
+ DateTime retVal;
+ parseStack.Push("dateTime");
+ try
+ {
+ XmlNode child = node.FirstChild;
+ if (child == null)
+ {
+ if (MapEmptyDateTimeToMinValue)
+ return DateTime.MinValue;
+ else
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains empty dateTime value "
+ + StackDump(parseStack));
+ }
+ string s = child.Value;
+ try
+ {
+ // XML-RPC spec yyyyMMddThh:mm:ss
+ string dateTimeFormat = "yyyyMMdd'T'HH':'mm':'ss";
+ if (AllowNonStandardDateTime)
+ {
+ if (s.IndexOf("T") == 8)
+ {
+ if (s.EndsWith("Z"))
+ {
+ // WordPress yyyyMMddThh:mm:ssZ
+ dateTimeFormat = "yyyyMMdd'T'HH':'mm':'ss'Z'";
+ }
+ }
+ else
+ {
+ if (s.EndsWith("Z"))
+ {
+ // TypePad yyyy-MM-ddThh:mm:ssZ
+ dateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'";
+ }
+ else
+ {
+ // other yyyy-MM-ddThh:mm:ss
+ dateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
+ }
+ }
+ }
+ if (MapZerosDateTimeToMinValue && s.StartsWith("0000")
+ && (s == "00000000T00:00:00" || s == "0000-00-00T00:00:00Z"
+ || s == "00000000T00:00:00Z" || s == "0000-00-00T00:00:00"))
+ retVal = DateTime.MinValue;
+ else
+ retVal = DateTime.ParseExact(s, dateTimeFormat,
+ DateTimeFormatInfo.InvariantInfo);
+ }
+ catch(Exception)
+ {
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains invalid dateTime value "
+ + StackDump(parseStack));
+ }
+ }
+ finally
+ {
+ parseStack.Pop();
+ }
+ if (ValueType == typeof(XmlRpcDateTime))
+ return new XmlRpcDateTime(retVal);
+ else
+ return retVal;
+ }
+
+ Object ParseBase64(
+ XmlNode node,
+ Type ValueType,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ if (ValueType != null && ValueType != typeof(byte[])
+ && ValueType != typeof(Object))
+ {
+ throw new XmlRpcTypeMismatchException(parseStack.ParseType
+ + " contains base64 value where "
+ + XmlRpcServiceInfo.GetXmlRpcTypeString(ValueType)
+ + " expected " + StackDump(parseStack));
+ }
+ byte[] ret;
+ parseStack.Push("base64");
+ try
+ {
+ if (node.FirstChild == null)
+ ret = new byte[0];
+ else
+ {
+ string s = node.FirstChild.Value;
+ try
+ {
+ ret = Convert.FromBase64String(s);
+ }
+ catch (Exception)
+ {
+ throw new XmlRpcInvalidXmlRpcException(parseStack.ParseType
+ + " contains invalid base64 value "
+ + StackDump(parseStack));
+ }
+ }
+ }
+ finally
+ {
+ parseStack.Pop();
+ }
+ return ret;
+ }
+
+ XmlRpcFaultException ParseFault(
+ XmlNode faultNode,
+ ParseStack parseStack,
+ MappingAction mappingAction)
+ {
+ XmlNode valueNode = SelectSingleNode(faultNode, "value");
+ XmlNode structNode = SelectSingleNode(valueNode, "struct");
+ if (structNode == null)
+ {
+ throw new XmlRpcInvalidXmlRpcException(
+ "struct element missing from fault response.");
+ }
+ Fault fault;
+ try
+ {
+ fault = (Fault)ParseValue(structNode, typeof(Fault), parseStack,
+ mappingAction);
+ }
+ catch(Exception ex)
+ {
+ // some servers incorrectly return fault code in a string
+ if (AllowStringFaultCode)
+ throw;
+ else
+ {
+ FaultStructStringCode faultStrCode;
+ try
+ {
+ faultStrCode = (FaultStructStringCode)ParseValue(structNode,
+ typeof(FaultStructStringCode), parseStack, mappingAction);
+ fault.faultCode = Convert.ToInt32(faultStrCode.faultCode);
+ fault.faultString = faultStrCode.faultString;
+ }
+ catch (Exception)
+ {
+ // use exception from when attempting to parse code as integer
+ throw ex;
+ }
+ }
+ }
+ return new XmlRpcFaultException(fault.faultCode, fault.faultString);
+ }
+
+ struct FaultStruct
+ {
+ public int faultCode;
+ public string faultString;
+ }
+
+ struct FaultStructStringCode
+ {
+ public string faultCode;
+ public string faultString;
+ }
+
+ public void SerializeFaultResponse(
+ Stream stm,
+ XmlRpcFaultException faultEx)
+ {
+ FaultStruct fs;
+ fs.faultCode = faultEx.FaultCode;
+ fs.faultString = faultEx.FaultString;
+
+ XmlTextWriter xtw = new XmlTextWriter(stm, m_encoding);
+ ConfigureXmlFormat(xtw);
+ xtw.WriteStartDocument();
+ xtw.WriteStartElement("", "methodResponse", "");
+ xtw.WriteStartElement("", "fault", "");
+ Serialize(xtw, fs, MappingAction.Error);
+ xtw.WriteEndElement();
+ xtw.WriteEndElement();
+ xtw.Flush();
+ }
+
+ void ConfigureXmlFormat(
+ XmlTextWriter xtw)
+ {
+ if (m_bUseIndentation)
+ {
+ xtw.Formatting = Formatting.Indented;
+ xtw.Indentation = m_indentation;
+ }
+ else
+ {
+ xtw.Formatting = Formatting.None;
+ }
+ }
+
+ string StackDump(ParseStack parseStack)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (string elem in parseStack)
+ {
+ sb.Insert(0, elem);
+ sb.Insert(0, " : ");
+ }
+ sb.Insert(0, parseStack.ParseType);
+ sb.Insert(0, "[");
+ sb.Append("]");
+ return sb.ToString();
+ }
+
+ XmlNode SelectSingleNode(XmlNode node, string name)
+ {
+ XmlNodeList nodes = node.ChildNodes;
+ for (int i = 0; i < nodes.Count; i++)
+ {
+ if (nodes[i].Name == name)
+ return nodes[i];
+ }
+ return null;
+ }
+
+ void SelectTwoNodes(XmlNode node, string name1, out XmlNode node1,
+ out bool dup1, string name2, out XmlNode node2, out bool dup2)
+ {
+ node1 = node2 = null;
+ dup1 = dup2 = false;
+ XmlNodeList nodes = node.ChildNodes;
+ for (int i = 0; i < nodes.Count; i++)
+ {
+ if (nodes[i].Name == name1)
+ {
+ if (node1 == null)
+ node1 = nodes[i];
+ else
+ dup1 = true;
+ }
+ else if (nodes[i].Name == name2)
+ {
+ if (node2 == null)
+ node2 = nodes[i];
+ else
+ dup2 = true;
+ }
+ }
+ }
+
+ // TODO: following to return Array?
+ object CreateArrayInstance(Type type, object[] args)
+ {
+#if (!COMPACT_FRAMEWORK)
+ return Activator.CreateInstance(type, args);
+#else
+ Object Arr = Array.CreateInstance(type.GetElementType(), (int)args[0]);
+ return Arr;
+#endif
+ }
+
+ //#if (DEBUG)
+ public
+ //#endif
+ class ParseStack : Stack
+ {
+ public ParseStack(string parseType)
+ {
+ m_parseType = parseType;
+ }
+
+ void Push(string str)
+ {
+ base.Push(str);
+ }
+
+ public string ParseType
+ {
+ get { return m_parseType; }
+ }
+
+ public string m_parseType = "";
+ }
+ }
+
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerFormatterSink.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerFormatterSink.cs
new file mode 100644
index 0000000..69791ea
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerFormatterSink.cs
@@ -0,0 +1,199 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Messaging;
+
+using CookComputing.XmlRpc;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcServerFormatterSink : IServerChannelSink
+ {
+ //constructors
+ //
+ public XmlRpcServerFormatterSink(
+ IServerChannelSink Next)
+ {
+ m_next = Next;
+ }
+
+ // properties
+ //
+ public IServerChannelSink NextChannelSink
+ {
+ get { return m_next; }
+ }
+
+ public IDictionary Properties
+ {
+ get { return null; }
+ }
+
+ // public methods
+ //
+ public void AsyncProcessResponse(
+ IServerResponseChannelSinkStack sinkStack,
+ object state,
+ IMessage msg,
+ ITransportHeaders headers,
+ Stream stream
+ )
+ {
+ throw new NotSupportedException();
+ }
+
+ public Stream GetResponseStream(
+ IServerResponseChannelSinkStack sinkStack,
+ object state,
+ IMessage msg,
+ ITransportHeaders headers)
+ {
+ throw new NotSupportedException();
+ }
+
+ public ServerProcessing ProcessMessage(
+ IServerChannelSinkStack sinkStack,
+ IMessage requestMsg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out IMessage responseMsg,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream
+ )
+ {
+ // use presence of SOAPAction header to determine if this is a SOAP
+ // request - if so pass onto next sink in chain
+ string soapAction = (string) requestHeaders["SOAPAction"];
+ if (soapAction != null)
+ {
+ return m_next.ProcessMessage(sinkStack, requestMsg, requestHeaders,
+ requestStream, out responseMsg, out responseHeaders,
+ out responseStream);
+ }
+
+ // for time being assume we have an XML-RPC request (need to improve
+ // this in case there are other non-SOAP formatters in the chain)
+ try
+ {
+ MethodCall mthdCall = DeserializeRequest(requestHeaders, requestStream);
+ sinkStack.Push(this, mthdCall);
+ // forward to next sink in chain - pass request stream as null to
+ // indicate that we have deserialized the request
+ m_next.ProcessMessage(sinkStack, mthdCall, requestHeaders, null,
+ out responseMsg, out responseHeaders, out responseStream);
+ SerializeResponse(responseMsg, ref responseHeaders, ref responseStream);
+ }
+ catch (Exception ex)
+ {
+ responseMsg = new ReturnMessage(ex, (IMethodCallMessage)requestMsg);
+ responseStream = new MemoryStream();
+ XmlRpcFaultException fex = new XmlRpcFaultException(0, ex.Message);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ serializer.SerializeFaultResponse(responseStream,
+ (XmlRpcFaultException)fex);
+ responseHeaders = new TransportHeaders();
+ }
+ return ServerProcessing.Complete;
+ }
+
+ // private methods
+ //
+ MethodCall DeserializeRequest(
+ ITransportHeaders requestHeaders,
+ Stream requestStream)
+ {
+ string requestUri = (string) requestHeaders["__RequestUri"];
+ Type svcType = GetServiceType(requestUri);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest xmlRpcReq
+ = serializer.DeserializeRequest(requestStream, svcType);
+ Header[] headers = GetChannelHeaders(requestHeaders, xmlRpcReq, svcType);
+ MethodCall mthdCall = new MethodCall(headers);
+ mthdCall.ResolveMethod();
+ return mthdCall;
+ }
+
+ void SerializeResponse(
+ IMessage responseMsg,
+ ref ITransportHeaders responseHeaders,
+ ref Stream responseStream)
+ {
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ responseStream = new MemoryStream();
+ responseHeaders = new TransportHeaders();
+
+ ReturnMessage retMsg = (ReturnMessage)responseMsg;
+ if (retMsg.Exception == null)
+ {
+ XmlRpcResponse xmlRpcResp = new XmlRpcResponse(retMsg.ReturnValue);
+ serializer.SerializeResponse(responseStream, xmlRpcResp);
+ }
+ else if (retMsg.Exception is XmlRpcFaultException)
+ {
+ serializer.SerializeFaultResponse(responseStream,
+ (XmlRpcFaultException)retMsg.Exception);
+ }
+ else
+ {
+ serializer.SerializeFaultResponse(responseStream,
+ new XmlRpcFaultException(1, retMsg.Exception.Message));
+ }
+ responseHeaders["Content-Type"] = "text/xml; charset=\"utf-8\"";
+ }
+
+ Header[] GetChannelHeaders(
+ ITransportHeaders requestHeaders,
+ XmlRpcRequest xmlRpcReq,
+ Type svcType)
+ {
+ string requestUri = (string) requestHeaders["__RequestUri"];
+ XmlRpcServiceInfo svcInfo = XmlRpcServiceInfo.CreateServiceInfo(svcType);
+ ArrayList hdrList = new ArrayList();
+ hdrList.Add(new Header("__Uri", requestUri));
+ hdrList.Add(new Header("__TypeName", svcType.AssemblyQualifiedName));
+ hdrList.Add(new Header("__MethodName",
+ svcInfo.GetMethodName(xmlRpcReq.method)));
+ hdrList.Add(new Header("__Args", xmlRpcReq.args));
+ return (Header[])hdrList.ToArray(typeof(Header));
+ }
+
+ public static Type GetServiceType(String Uri)
+ {
+ Type type = RemotingServices.GetServerTypeForUri(Uri);
+ if (type != null)
+ return type;
+ throw new Exception(string.Format("No service type registered "
+ + "for uri {0}", Uri));
+ }
+
+ IServerChannelSink m_next;
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerFormatterSinkProvider.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerFormatterSinkProvider.cs
new file mode 100644
index 0000000..20fd266
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerFormatterSinkProvider.cs
@@ -0,0 +1,81 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.Collections;
+using System.Runtime.Remoting.Channels;
+
+using CookComputing.XmlRpc;
+
+namespace CookComputing.XmlRpc
+{
+ public class XmlRpcServerFormatterSinkProvider : IServerFormatterSinkProvider
+ {
+ // constructors
+ public XmlRpcServerFormatterSinkProvider(
+ IDictionary properties,
+ ICollection providerData)
+ {
+ // can use properties to pass in custom attributes from the config
+ // file which can then be passed to sink constructor as required
+ }
+
+ public XmlRpcServerFormatterSinkProvider()
+ {
+ // can use properties to pass in custom attributes from the config
+ // file which can then be passed to sink constructor as required
+ }
+
+ // properties
+ //
+ public IServerChannelSinkProvider Next
+ {
+ get { return m_next; }
+ set { m_next = value; }
+ }
+
+ // public methods
+ //
+ public IServerChannelSink CreateSink(
+ IChannelReceiver channel)
+ {
+ IServerChannelSink scs = null;
+ if (m_next != null)
+ {
+ scs = m_next.CreateSink(channel);
+ }
+ return new XmlRpcServerFormatterSink(scs);
+ }
+
+ public void GetChannelData(IChannelDataStore channelData)
+ {
+ // TODO: not required???
+ }
+
+ // data
+ //
+ IServerChannelSinkProvider m_next;
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerProtocol.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerProtocol.cs
new file mode 100644
index 0000000..b6fe361
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServerProtocol.cs
@@ -0,0 +1,181 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Collections;
+ using System.IO;
+ using System.Reflection;
+ using System.Text.RegularExpressions;
+
+ public class XmlRpcServerProtocol
+ {
+ public Stream Invoke(Stream requestStream)
+ {
+ try
+ {
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ XmlRpcRequest xmlRpcReq
+ = serializer.DeserializeRequest(requestStream, this.GetType());
+ XmlRpcResponse xmlRpcResp = Invoke(xmlRpcReq);
+ Stream responseStream = new MemoryStream();
+ serializer.SerializeResponse(responseStream, xmlRpcResp);
+ responseStream.Seek(0, SeekOrigin.Begin);
+ return responseStream;
+ }
+ catch (Exception ex)
+ {
+ XmlRpcFaultException fex;
+ if (ex is XmlRpcException)
+ fex = new XmlRpcFaultException(0, ((XmlRpcException)ex).Message);
+ else if (ex is XmlRpcFaultException)
+ fex = (XmlRpcFaultException)ex;
+ else
+ fex = new XmlRpcFaultException(0, ex.Message);
+ XmlRpcSerializer serializer = new XmlRpcSerializer();
+ Stream responseStream = new MemoryStream();
+ serializer.SerializeFaultResponse(responseStream, fex);
+ responseStream.Seek(0, SeekOrigin.Begin);
+ return responseStream;
+ }
+ }
+
+ public XmlRpcResponse Invoke(XmlRpcRequest request)
+ {
+ MethodInfo mi = null;
+ if (request.mi != null)
+ {
+ mi = request.mi;
+ }
+ else
+ {
+ mi = this.GetType().GetMethod(request.method);
+ }
+ // exceptions thrown during an MethodInfo.Invoke call are
+ // package as inner of
+ Object reto;
+ try
+ {
+ reto = mi.Invoke(this, request.args);
+ }
+ catch(Exception ex)
+ {
+ if (ex.InnerException != null)
+ throw ex.InnerException;
+ throw ex;
+ }
+ XmlRpcResponse response = new XmlRpcResponse(reto);
+ return response;
+ }
+
+ bool IsVisibleXmlRpcMethod(MethodInfo mi)
+ {
+ bool ret = false;
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcMethodAttribute));
+ if (attr != null)
+ {
+ XmlRpcMethodAttribute mattr = (XmlRpcMethodAttribute)attr;
+ ret = !mattr.Hidden;
+ }
+ return ret;
+ }
+
+ [XmlRpcMethod("system.listMethods", IntrospectionMethod = true,
+ Description=
+ "Return an array of all available XML-RPC methods on this Service.")]
+ public string[] System__List__Methods___()
+ {
+ XmlRpcServiceInfo svcInfo = XmlRpcServiceInfo.CreateServiceInfo(
+ this.GetType());
+ ArrayList alist = new ArrayList();
+ foreach (XmlRpcMethodInfo mthdInfo in svcInfo.Methods)
+ {
+ if (!mthdInfo.IsHidden)
+ alist.Add(mthdInfo.XmlRpcName);
+ }
+ return (String[])alist.ToArray(typeof(string));
+ }
+
+ [XmlRpcMethod("system.methodSignature", IntrospectionMethod = true,
+ Description=
+ "Given the name of a method, return an array of legal signatures. "+
+ "Each signature is an array of strings. The first item of each "+
+ "signature is the return type, and any others items are parameter "+
+ "types.")]
+ public Array System__Method__Signature___(string MethodName)
+ {
+ //TODO: support overloaded methods
+ XmlRpcServiceInfo svcInfo = XmlRpcServiceInfo.CreateServiceInfo(
+ this.GetType());
+ XmlRpcMethodInfo mthdInfo = svcInfo.GetMethod(MethodName);
+ if (mthdInfo == null)
+ {
+ throw new XmlRpcFaultException(880,
+ "Request for information on unsupported method");
+ }
+ if (mthdInfo.IsHidden)
+ {
+ throw new XmlRpcFaultException(881,
+ "Information not available on this method");
+ }
+ //XmlRpcTypes.CheckIsXmlRpcMethod(mi);
+ ArrayList alist = new ArrayList();
+ alist.Add(XmlRpcServiceInfo.GetXmlRpcTypeString(mthdInfo.ReturnType));
+ foreach (XmlRpcParameterInfo paramInfo in mthdInfo.Parameters)
+ {
+ alist.Add(XmlRpcServiceInfo.GetXmlRpcTypeString(paramInfo.Type));
+ }
+ string[] types = (string[])alist.ToArray(typeof(string));
+ ArrayList retalist = new ArrayList();
+ retalist.Add(types);
+ Array retarray = retalist.ToArray(typeof(string[]));
+ return retarray;
+ }
+
+ [XmlRpcMethod("system.methodHelp", IntrospectionMethod = true,
+ Description=
+ "Given the name of a method, return a help string.")]
+ public string System__Method__Help___(string MethodName)
+ {
+ //TODO: support overloaded methods?
+ XmlRpcServiceInfo svcInfo = XmlRpcServiceInfo.CreateServiceInfo(
+ this.GetType());
+ XmlRpcMethodInfo mthdInfo = svcInfo.GetMethod(MethodName);
+ if (mthdInfo == null)
+ {
+ throw new XmlRpcFaultException(880,
+ "Request for information on unsupported method");
+ }
+ if (mthdInfo.IsHidden)
+ {
+ throw new XmlRpcFaultException(881,
+ "Information not available for this method");
+ }
+ return mthdInfo.Doc;
+ }
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcService.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcService.cs
new file mode 100644
index 0000000..ade4619
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcService.cs
@@ -0,0 +1,66 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Web;
+ using System.Web.SessionState;
+
+ public class XmlRpcService : XmlRpcHttpServerProtocol,
+ IHttpHandler, IRequiresSessionState
+ {
+ // note: IRequiresSessionState specifies that the target HTTP handler
+ // interface has read and write access to session-state values.
+ // This is a marker interface only and has no methods.
+
+ protected HttpContext Context { get { return context; } }
+
+ void IHttpHandler.ProcessRequest(HttpContext RequestContext)
+ {
+ try
+ {
+ // store context for access from application code in derived classes
+ context = RequestContext;
+ // XmlRpc classes delegate to the corresponding Context classes
+ XmlRpcHttpRequest httpReq = new XmlRpcHttpRequest(context.Request);
+ XmlRpcHttpResponse httpResp = new XmlRpcHttpResponse(context.Response);
+ HandleHttpRequest(httpReq, httpResp);
+ }
+ catch (Exception ex)
+ {
+ RequestContext.Response.StatusCode = 500; // "Internal server error"
+ RequestContext.Response.StatusDescription = ex.Message;
+ }
+ }
+
+ bool IHttpHandler.IsReusable
+ {
+ get { return true; }
+ }
+
+ private HttpContext context;
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServiceAttribute.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServiceAttribute.cs
new file mode 100644
index 0000000..6150f03
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServiceAttribute.cs
@@ -0,0 +1,79 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
+ public class XmlRpcServiceAttribute : Attribute
+ {
+ public XmlRpcServiceAttribute()
+ {
+ }
+
+ public bool AutoDocumentation
+ {
+ get { return autoDocumentation; }
+ set { autoDocumentation = value; }
+ }
+
+ public bool AutoDocVersion
+ {
+ get { return autoDocVersion; }
+ set { autoDocVersion = value; }
+ }
+
+ public string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public bool Introspection
+ {
+ get { return introspection; }
+ set { introspection = value; }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public override string ToString()
+ {
+ string value = "Description : " + description;
+ return value;
+ }
+
+ private string description = "";
+ private bool introspection = false;
+ private bool autoDocumentation = true;
+ private bool autoDocVersion = true;
+ private string name = "";
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServiceInfo.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServiceInfo.cs
new file mode 100644
index 0000000..d9132f7
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcServiceInfo.cs
@@ -0,0 +1,416 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Collections;
+ using System.Reflection;
+ using System.Text.RegularExpressions;
+
+ public enum XmlRpcType
+ {
+ tInvalid,
+ tInt32,
+ tBoolean,
+ tString,
+ tDouble,
+ tDateTime,
+ tBase64,
+ tStruct,
+ tHashtable,
+ tArray,
+ tMultiDimArray,
+ tVoid
+ }
+
+ public class XmlRpcServiceInfo
+ {
+ public static XmlRpcServiceInfo CreateServiceInfo(Type type)
+ {
+ XmlRpcServiceInfo svcInfo = new XmlRpcServiceInfo();
+ // extract service info
+ XmlRpcServiceAttribute svcAttr = (XmlRpcServiceAttribute)
+ Attribute.GetCustomAttribute(type, typeof(XmlRpcServiceAttribute));
+ if (svcAttr != null && svcAttr.Description != "")
+ svcInfo.doc = svcAttr.Description;
+ if (svcAttr != null && svcAttr.Name != "")
+ svcInfo.Name = svcAttr.Name;
+ else
+ svcInfo.Name = type.Name;
+ // extract method info
+ Hashtable methods = new Hashtable();
+
+ foreach(Type itf in type.GetInterfaces())
+ {
+ XmlRpcServiceAttribute itfAttr = (XmlRpcServiceAttribute)
+ Attribute.GetCustomAttribute(itf, typeof(XmlRpcServiceAttribute));
+ if (itfAttr != null)
+ svcInfo.doc = itfAttr.Description;
+#if (!COMPACT_FRAMEWORK)
+ InterfaceMapping imap = type.GetInterfaceMap(itf);
+ foreach (MethodInfo mi in imap.InterfaceMethods)
+ {
+ ExtractMethodInfo(methods, mi);
+ }
+#else
+ foreach (MethodInfo mi in itf.GetMethods())
+ {
+ ExtractMethodInfo(methods, mi);
+ }
+#endif
+ }
+
+ foreach (MethodInfo mi in type.GetMethods())
+ {
+ ArrayList mthds = new ArrayList();
+ mthds.Add(mi);
+ MethodInfo curMi = mi;
+ while (true)
+ {
+ MethodInfo baseMi = curMi.GetBaseDefinition();
+ if (baseMi.DeclaringType == curMi.DeclaringType)
+ break;
+ mthds.Insert(0, baseMi);
+ curMi = baseMi;
+ }
+ foreach(MethodInfo mthd in mthds)
+ {
+ ExtractMethodInfo(methods, mthd);
+ }
+ }
+ svcInfo.methodInfos = new XmlRpcMethodInfo[methods.Count];
+ methods.Values.CopyTo(svcInfo.methodInfos, 0);
+ Array.Sort(svcInfo.methodInfos);
+ return svcInfo;
+ }
+
+ static void ExtractMethodInfo(Hashtable methods, MethodInfo mi)
+ {
+ XmlRpcMethodAttribute attr = (XmlRpcMethodAttribute)
+ Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcMethodAttribute));
+ if (attr == null)
+ return;
+
+ XmlRpcMethodInfo mthdInfo = (XmlRpcMethodInfo)methods[mi.Name];
+ if (mthdInfo == null)
+ {
+ mthdInfo = new XmlRpcMethodInfo();
+ methods.Add(mi.Name, mthdInfo);
+ }
+
+ mthdInfo.MethodInfo = mi;
+ mthdInfo.XmlRpcName = GetXmlRpcMethodName(mi);
+ mthdInfo.MiName = mi.Name;
+ mthdInfo.Doc = attr.Description;
+ mthdInfo.IsHidden = attr.IntrospectionMethod | attr.Hidden;
+ // extract parameters information
+ ArrayList parmList = new ArrayList();
+ ParameterInfo[] parms = mi.GetParameters();
+ foreach (ParameterInfo parm in parms)
+ {
+ XmlRpcParameterInfo parmInfo = new XmlRpcParameterInfo();
+ parmInfo.Name = parm.Name;
+ parmInfo.Type = parm.ParameterType;
+ parmInfo.XmlRpcType = GetXmlRpcTypeString(parm.ParameterType);
+ // retrieve optional attributed info
+ parmInfo.Doc = "";
+ XmlRpcParameterAttribute pattr = (XmlRpcParameterAttribute)
+ Attribute.GetCustomAttribute(parm,
+ typeof(XmlRpcParameterAttribute));
+ if (pattr != null)
+ {
+ parmInfo.Doc = pattr.Description;
+ parmInfo.XmlRpcName = pattr.Name;
+ }
+ parmInfo.IsParams = Attribute.IsDefined(parm,
+ typeof(ParamArrayAttribute));
+ parmList.Add(parmInfo);
+ }
+ mthdInfo.Parameters = (XmlRpcParameterInfo[])
+ parmList.ToArray(typeof(XmlRpcParameterInfo));
+ // extract return type information
+ mthdInfo.ReturnType = mi.ReturnType;
+ mthdInfo.ReturnXmlRpcType = GetXmlRpcTypeString(mi.ReturnType);
+ object[] orattrs = mi.ReturnTypeCustomAttributes.GetCustomAttributes(
+ typeof(XmlRpcReturnValueAttribute), false);
+ if (orattrs.Length > 0)
+ {
+ mthdInfo.ReturnDoc = ((XmlRpcReturnValueAttribute)orattrs[0]).Description;
+ }
+
+ }
+
+ public MethodInfo GetMethodInfo(string xmlRpcMethodName)
+ {
+ foreach (XmlRpcMethodInfo xmi in methodInfos)
+ {
+ if (xmlRpcMethodName == xmi.XmlRpcName)
+ {
+ return xmi.MethodInfo;
+ }
+ }
+ return null;
+ }
+
+ static bool IsVisibleXmlRpcMethod(MethodInfo mi)
+ {
+ bool ret = false;
+ Attribute attr = Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcMethodAttribute));
+ if (attr != null)
+ {
+ XmlRpcMethodAttribute mattr = (XmlRpcMethodAttribute)attr;
+ ret = !(mattr.Hidden || mattr.IntrospectionMethod == true);
+ }
+ return ret;
+ }
+
+ public static string GetXmlRpcMethodName(MethodInfo mi)
+ {
+ XmlRpcMethodAttribute attr = (XmlRpcMethodAttribute)
+ Attribute.GetCustomAttribute(mi,
+ typeof(XmlRpcMethodAttribute));
+ if (attr != null
+ && attr.Method != null
+ && attr.Method != "")
+ {
+ return attr.Method;
+ }
+ else
+ {
+ return mi.Name;
+ }
+ }
+
+ public string GetMethodName(string XmlRpcMethodName)
+ {
+ foreach (XmlRpcMethodInfo methodInfo in methodInfos)
+ {
+ if (methodInfo.XmlRpcName == XmlRpcMethodName)
+ return methodInfo.MiName;
+ }
+ return null;
+ }
+
+ public String Doc
+ {
+ get { return doc; }
+ set { doc = value; }
+ }
+
+ public String Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public XmlRpcMethodInfo[] Methods
+ {
+ get { return methodInfos; }
+ }
+
+ public XmlRpcMethodInfo GetMethod(
+ String methodName)
+ {
+ foreach (XmlRpcMethodInfo mthdInfo in methodInfos)
+ {
+ if (mthdInfo.XmlRpcName == methodName)
+ return mthdInfo;
+ }
+ return null;
+ }
+
+ private XmlRpcServiceInfo()
+ {
+ }
+
+ public static XmlRpcType GetXmlRpcType(Type t)
+ {
+ XmlRpcType ret;
+ if (t == typeof(Int32))
+ ret = XmlRpcType.tInt32;
+ else if (t == typeof(XmlRpcInt))
+ ret = XmlRpcType.tInt32;
+ else if (t == typeof(Boolean))
+ ret = XmlRpcType.tBoolean;
+ else if (t == typeof(XmlRpcBoolean))
+ ret = XmlRpcType.tBoolean;
+ else if (t == typeof(String))
+ ret = XmlRpcType.tString;
+ else if (t == typeof(Double))
+ ret = XmlRpcType.tDouble;
+ else if (t == typeof(XmlRpcDouble))
+ ret = XmlRpcType.tDouble;
+ else if (t == typeof(DateTime))
+ ret = XmlRpcType.tDateTime;
+ else if (t == typeof(XmlRpcDateTime))
+ ret = XmlRpcType.tDateTime;
+ else if (t == typeof(byte[]))
+ ret = XmlRpcType.tBase64;
+ else if (t == typeof(XmlRpcStruct))
+ {
+ ret = XmlRpcType.tHashtable;
+ }
+ else if (t == typeof(Array))
+ ret = XmlRpcType.tArray;
+ else if (t.IsArray)
+ {
+#if (!COMPACT_FRAMEWORK)
+ Type elemType = t.GetElementType();
+ if (elemType != typeof(Object)
+ && GetXmlRpcType(elemType) == XmlRpcType.tInvalid)
+ {
+ ret = XmlRpcType.tInvalid;
+ }
+ else
+ {
+ if (t.GetArrayRank() == 1) // single dim array
+ ret = XmlRpcType.tArray;
+ else
+ ret = XmlRpcType.tMultiDimArray;
+ }
+#else
+ //!! check types of array elements if not Object[]
+ Type elemType = null;
+ string[] checkSingleDim = Regex.Split(t.FullName, "\\[\\]$");
+ if (checkSingleDim.Length > 1) // single dim array
+ {
+ elemType = Type.GetType(checkSingleDim[0]);
+ ret = XmlRpcType.tArray;
+ }
+ else
+ {
+ string[] checkMultiDim = Regex.Split(t.FullName, "\\[,[,]*\\]$");
+ if (checkMultiDim.Length > 1)
+ {
+ elemType = Type.GetType(checkMultiDim[0]);
+ ret = XmlRpcType.tMultiDimArray;
+ }
+ else
+ ret = XmlRpcType.tInvalid;
+ }
+ if (elemType != null)
+ {
+ if (elemType != typeof(Object)
+ && GetXmlRpcType(elemType) == XmlRpcType.tInvalid)
+ {
+ ret = XmlRpcType.tInvalid;
+ }
+ }
+#endif
+
+ }
+#if !FX1_0
+ else if (t == typeof(int?))
+ ret = XmlRpcType.tInt32;
+ else if (t == typeof(Boolean?))
+ ret = XmlRpcType.tBoolean;
+ else if (t == typeof(Double?))
+ ret = XmlRpcType.tDouble;
+ else if (t == typeof(DateTime?))
+ ret = XmlRpcType.tDateTime;
+#endif
+ else if (t == typeof(void))
+ {
+ ret = XmlRpcType.tVoid;
+ }
+ else if ((t.IsValueType && !t.IsPrimitive && !t.IsEnum)
+ || t.IsClass)
+ {
+ // if type is struct or class its only valid for XML-RPC mapping if all
+ // its members have a valid mapping or are of type object which
+ // maps to any XML-RPC type
+ MemberInfo[] mis = t.GetMembers();
+ foreach (MemberInfo mi in mis)
+ {
+ if (mi.MemberType == MemberTypes.Field)
+ {
+ FieldInfo fi = (FieldInfo)mi;
+ if (fi.FieldType != typeof(Object)
+ && GetXmlRpcType(fi.FieldType) == XmlRpcType.tInvalid)
+ {
+ return XmlRpcType.tInvalid;
+ }
+ }
+ else if (mi.MemberType == MemberTypes.Property)
+ {
+ PropertyInfo pi = (PropertyInfo)mi;
+ if (pi.PropertyType != typeof(Object)
+ && GetXmlRpcType(pi.PropertyType) == XmlRpcType.tInvalid)
+ {
+ return XmlRpcType.tInvalid;
+ }
+ }
+ }
+ ret = XmlRpcType.tStruct;
+ }
+ else
+ ret = XmlRpcType.tInvalid;
+ return ret;
+ }
+
+ static public string GetXmlRpcTypeString(Type t)
+ {
+ XmlRpcType rpcType = GetXmlRpcType(t);
+ return GetXmlRpcTypeString(rpcType);
+ }
+
+ static public string GetXmlRpcTypeString(XmlRpcType t)
+ {
+ string ret = null;
+ if (t == XmlRpcType.tInt32)
+ ret = "integer";
+ else if (t == XmlRpcType.tBoolean)
+ ret = "boolean";
+ else if (t == XmlRpcType.tString)
+ ret = "string";
+ else if (t == XmlRpcType.tDouble)
+ ret = "double";
+ else if (t == XmlRpcType.tDateTime)
+ ret = "dateTime";
+ else if (t == XmlRpcType.tBase64)
+ ret = "base64";
+ else if (t == XmlRpcType.tStruct)
+ ret = "struct";
+ else if (t == XmlRpcType.tHashtable)
+ ret = "struct";
+ else if (t == XmlRpcType.tArray)
+ ret = "array";
+ else if (t == XmlRpcType.tMultiDimArray)
+ ret = "array";
+ else if (t == XmlRpcType.tVoid)
+ ret = "void";
+ else
+ ret = null;
+ return ret;
+ }
+
+ XmlRpcMethodInfo[] methodInfos;
+ String doc;
+ string name;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcStruct.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcStruct.cs
new file mode 100644
index 0000000..0db19b5
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcStruct.cs
@@ -0,0 +1,97 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Collections;
+
+ public class XmlRpcStruct : Hashtable
+ {
+ public override void Add(object key, object value)
+ {
+ if (!(key is string))
+ {
+ throw new ArgumentException("XmlRpcStruct key must be a string.");
+ }
+ if (XmlRpcServiceInfo.GetXmlRpcType(value.GetType())
+ == XmlRpcType.tInvalid)
+ {
+ throw new ArgumentException(String.Format(
+ "Type {0} cannot be mapped to an XML-RPC type", value.GetType()));
+ }
+ base.Add(key, value);
+ }
+
+ public override object this[object key]
+ {
+ get
+ {
+ return base[key];
+ }
+ set
+ {
+ if (!(key is string))
+ {
+ throw new ArgumentException("XmlRpcStruct key must be a string.");
+ }
+ if (XmlRpcServiceInfo.GetXmlRpcType(value.GetType())
+ == XmlRpcType.tInvalid)
+ {
+ throw new ArgumentException(String.Format(
+ "Type {0} cannot be mapped to an XML-RPC type", value.GetType()));
+ }
+ base[key] = value;
+ }
+ }
+
+ public override bool Equals(Object obj)
+ {
+ if (obj.GetType() != typeof(XmlRpcStruct))
+ return false;
+ XmlRpcStruct xmlRpcStruct = (XmlRpcStruct)obj;
+ if (this.Keys.Count != xmlRpcStruct.Count)
+ return false;
+ foreach (String key in this.Keys)
+ {
+ if (!xmlRpcStruct.ContainsKey(key))
+ return false;
+ if (!this[key].Equals(xmlRpcStruct[key]))
+ return false;
+ }
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ int hash = 0;
+ foreach (object obj in Values)
+ {
+ hash ^= obj.GetHashCode();
+ }
+ return hash;
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcUrlAttribute.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcUrlAttribute.cs
new file mode 100644
index 0000000..3ae5b1f
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/XmlRpcUrlAttribute.cs
@@ -0,0 +1,49 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface)]
+ public class XmlRpcUrlAttribute : Attribute
+ {
+ public XmlRpcUrlAttribute(string UriString)
+ {
+ this.uri = UriString;
+ }
+ public string Uri
+ {
+ get
+ { return uri; }
+ }
+ public override string ToString()
+ {
+ string value = "Uri : " + uri;
+ return value;
+ }
+ private string uri;
+ }
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/util.cs b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/util.cs
new file mode 100644
index 0000000..76fbfa5
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/util.cs
@@ -0,0 +1,99 @@
+/*
+XML-RPC.NET library
+Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+namespace CookComputing.XmlRpc
+{
+ using System;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Text;
+
+ public class Util
+ {
+ // protect constructor because static only class
+ protected Util()
+ {
+ }
+
+ static public void CopyStream(Stream src, Stream dst)
+ {
+ byte[] buff = new byte[4096];
+ while (true)
+ {
+ int read = src.Read(buff, 0, 4096);
+ if (read == 0)
+ break;
+ dst.Write(buff, 0, read);
+ }
+ }
+
+ public static Stream StringAsStream(string S)
+ {
+ MemoryStream mstm = new MemoryStream();
+ StreamWriter sw = new StreamWriter(mstm);
+ sw.Write(S);
+ sw.Flush();
+ mstm.Seek(0, SeekOrigin.Begin);
+ return mstm;
+ }
+
+#if (!COMPACT_FRAMEWORK)
+ public static void TraceStream(Stream stm)
+ {
+ TextReader trdr = new StreamReader(stm, new UTF8Encoding(), true, 4096);
+ String s = trdr.ReadLine();
+ while (s != null)
+ {
+ Trace.WriteLine(s);
+ s = trdr.ReadLine();
+ }
+ }
+
+ public static void DumpStream(Stream stm)
+ {
+ TextReader trdr = new StreamReader(stm);
+ String s = trdr.ReadLine();
+ while (s != null)
+ {
+ Trace.WriteLine(s);
+ s = trdr.ReadLine();
+ }
+ }
+#endif
+
+#if (!COMPACT_FRAMEWORK)
+ public static Guid NewGuid()
+ {
+ return Guid.NewGuid();
+ }
+#else
+ public static Guid NewGuid()
+ {
+ return OpenNETCF.GuidEx.NewGuid();
+ }
+#endif
+ }
+
+}
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/xmlrpc.csproj b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/xmlrpc.csproj
new file mode 100644
index 0000000..d94b4d4
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/xmlrpc.csproj
@@ -0,0 +1,248 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{1B4B0A58-0AFB-4090-91DD-18912CC7DE65}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>CookComputing.XmlRpcV2</AssemblyName>
+ <AssemblyOriginatorKeyFile Condition="'$(BuildingInsideVisualStudio)' == ''">..\..\..\CookComputing.key</AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>xmlrpc</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <SignAssembly Condition="'$(BuildingInsideVisualStudio)' == ''">true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>..\bin\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE;DEBUG</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>649</NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>..\bin\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>649</NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Drawing">
+ <Name>System.Drawing</Name>
+ </Reference>
+ <Reference Include="System.Web">
+ <Name>System.Web</Name>
+ </Reference>
+ <Reference Include="System.Windows.Forms">
+ <Name>System.Windows.Forms</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="GuidEx.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IHttpRequest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IHttpRequestHandler.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IHttpResponse.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IXmlRpcProxy.cs" />
+ <Compile Include="RequestResponseLogger.cs" />
+ <Compile Include="Tracer.cs" />
+ <Compile Include="util.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcAsyncResult.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcBeginAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcBoolean.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcClientFormatterSink.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcClientFormatterSinkProvider.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcClientProtocol.cs">
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="XmlRpcDateTime.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcDocWriter.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcDouble.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcEndAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcFaultException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcHttpRequest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcHttpResponse.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcHttpServerProtocol.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcInt.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcLogger.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcMemberAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcMethodAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcMethodInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcMissingMappingAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcNonStandard.cs" />
+ <Compile Include="XmlRpcParameterAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcParameterInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcProxyCodeGen.cs" />
+ <Compile Include="XmlRpcProxyGen.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcRequest.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcRequestEventArgs.cs" />
+ <Compile Include="XmlRpcResponse.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcResponseEventArgs.cs" />
+ <Compile Include="XmlRpcReturnValueAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcSerializer.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcServerFormatterSink.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcServerFormatterSinkProvider.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcServerProtocol.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcService.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcServiceAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcServiceInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcStruct.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlRpcUrlAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="CookComputing.XmlRpc.Targets" Condition="'$(BuildingInsideVisualStudio)' == '' AND '$(TargetFX1_0)'=='true'" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+ <Target Name="BeforeBuild">
+ <CreateItem Include="AssemblyBuildNumber.cs" Condition="'$(BuildingInsideVisualStudio)' == ''">
+ <Output TaskParameter="Include" ItemName="Compile" />
+ </CreateItem>
+ <CreateItem Include="AssemblyDescFX1_0.cs" Condition="'$(TargetFX1_0)'=='true'">
+ <Output TaskParameter="Include" ItemName="Compile" />
+ </CreateItem>
+ <CreateItem Include="AssemblyDesc.cs" Condition="'$(TargetFX1_0)'!='true'">
+ <Output TaskParameter="Include" ItemName="Compile" />
+ </CreateItem>
+ </Target>
+</Project> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/xmlrpc.sln b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/xmlrpc.sln
new file mode 100644
index 0000000..5906061
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/src/xmlrpc.sln
@@ -0,0 +1,28 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xmlrpc", "xmlrpc.csproj", "{1B4B0A58-0AFB-4090-91DD-18912CC7DE65}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ntest", "..\ntest\ntest.csproj", "{A03FD7C0-77B4-4731-8818-6E33A0A83E70}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1B4B0A58-0AFB-4090-91DD-18912CC7DE65} = {1B4B0A58-0AFB-4090-91DD-18912CC7DE65}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1B4B0A58-0AFB-4090-91DD-18912CC7DE65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B4B0A58-0AFB-4090-91DD-18912CC7DE65}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1B4B0A58-0AFB-4090-91DD-18912CC7DE65}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1B4B0A58-0AFB-4090-91DD-18912CC7DE65}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A03FD7C0-77B4-4731-8818-6E33A0A83E70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A03FD7C0-77B4-4731-8818-6E33A0A83E70}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A03FD7C0-77B4-4731-8818-6E33A0A83E70}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A03FD7C0-77B4-4731-8818-6E33A0A83E70}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xml-rpc.net.proj b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xml-rpc.net.proj
new file mode 100644
index 0000000..a111a5a
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xml-rpc.net.proj
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
+
+ <Target Name="Build"
+ DependsOnTargets="BuildXmlRpc1_0;BuildXmlRpc2_0;BuildXmlRpcCF1_0;BuildUnitTests;BuildSamples;BuildXrpGen">
+ </Target>
+
+ <Target Name="Release" DependsOnTargets="Clean;Build;Test;Package">
+ </Target>
+
+ <Target Name="Upload" DependsOnTargets="UploadDistribution;UploadWebPages">
+ </Target>
+
+ <PropertyGroup>
+ <!-- Major number is the major number of the most recent version of .NET
+ the build is targetted at -->
+ <Major>2</Major>
+ <Minor>1</Minor>
+ <Build>0</Build>
+ <Revision>3</Revision>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <BuildDir>./bin</BuildDir>
+ <BuildDir1_0>./bin1_0</BuildDir1_0>
+ <BuildOutput>./buildoutput</BuildOutput>
+ </PropertyGroup>
+
+ <Target Name ="Clean">
+ <RemoveDir Directories="$(BuildDir)" />
+ <RemoveDir Directories=".\src\obj" />
+ <RemoveDir Directories=".\ntest\bin" />
+ <RemoveDir Directories=".\ntest\obj" />
+ <Delete Files="src\AssemblyBuildNumber.cs" />
+ </Target>
+
+ <Target Name="Version1_0">
+ <AssemblyInfo CodeLanguage="CS"
+ OutputFile="src\AssemblyBuildNumber.cs"
+ AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)"
+ />
+ </Target>
+
+ <Target Name="Version2_0">
+
+ <AssemblyInfo CodeLanguage="CS"
+ OutputFile="src\AssemblyBuildNumber.cs"
+ AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)"
+ />
+ </Target>
+
+ <Target Name="VersionCF1_0">
+ <AssemblyInfo CodeLanguage="CS"
+ OutputFile="src\AssemblyBuildNumber.cs"
+ AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)"
+ />
+ </Target>
+
+ <Target Name="BuildXmlRpc1_0" DependsOnTargets="Version1_0">
+ <Error Text="Please supply your own key file" Condition = "!Exists('../../CookComputing.key')"/>
+ <MakeDir Directories = "$(BuildDir)" Condition = "!Exists('$($(BuildDir))')" />
+ <MakeDir Directories = "$(BuildDir1_0)" Condition = "!Exists('$($(BuildDir1_0))')" />
+ <MSBuild Projects="src\xmlrpc.csproj" Targets="Rebuild"
+ Properties="Configuration=Release;OutputPath=..\$(BuildDir1_0);DefineConstants=FX1_0;TargetFX1_0=true;AssemblyName=CookComputing.XmlRpc" />
+ </Target>
+
+ <Target Name="BuildXmlRpc2_0" DependsOnTargets="Version2_0">
+ <MakeDir Directories = "$(BuildDir)" Condition = "!Exists('$($(BuildDir))')" />
+ <MSBuild Projects="src\xmlrpc.csproj" Targets="Rebuild"
+ Properties="Configuration=Release" />
+ </Target>
+
+ <Target Name="BuildXmlRpcCF1_0" DependsOnTargets="VersionCF1_0">
+ <MakeDir Directories = "$(BuildDir)" Condition = "!Exists('$($(BuildDir))')" />
+ <MSBuild Projects="XmlRpcCF\xmlrpcCF.csproj" Targets="Rebuild"
+ Properties="Configuration=Release;OutputPath=..\$(BuildDir)" />
+ </Target>
+
+ <Target Name="BuildUnitTests" DependsOnTargets="BuildXmlRpc1_0;BuildXmlRpc2_0">
+ <MSBuild Projects="ntest\ntest.csproj" Targets="Rebuild"
+ Properties="Configuration=Release;ReferencePath=..\$(BuildDir);OutputPath=..\$(BuildDir)" />
+ <MSBuild Projects="ntest\ntest.csproj"
+ Properties="Configuration=Release;ReferencePath=..\$(BuildDir1_0);AssemblyName=ntest1_0;OutputPath=..\$(BuildDir1_0);DefineConstants=FX1_0;TargetFX1_0=true" />
+ </Target>
+
+ <Target Name="BuildSamples" DependsOnTargets="BuildXmlRpc1_0">
+ <MSBuild Projects="samples\AsyncBettyApplication\AsyncBettyApplication.csproj"
+ Properties="Configuration=Release" />
+ <MSBuild Projects="samples\BettyApplication\BettyApplication.csproj"
+ Properties="Configuration=Release" />
+ <MSBuild Projects="samples\LoggingExample\LoggingExample.csproj"
+ Properties="Configuration=Release" />
+ <MSBuild Projects="samples\MathApp\MathApp.csproj"
+ Properties="Configuration=Release" />
+ <MSBuild Projects="samples\MathService\MathService.sln"
+ Properties="Configuration=Release" />
+ <MSBuild Projects="samples\StateNameServer\StateNameServer.sln"
+ Properties="Configuration=Release" />
+ <!-- <MSBuild Projects="samples\SumAndDiff\SumAndDiff.csproj"
+ Properties="Configuration=Release" />
+ <MSBuild Projects="samples\LoggingExample\LoggingExample.csproj"
+ Properties="Configuration=Release" /> -->
+ <Copy
+ SourceFiles="samples/StateNameServer/server/StateNameServer.exe.config"
+ DestinationFolder="$(BuildDir)"
+ />
+ </Target>
+
+ <Target Name="BuildXrpGen" DependsOnTargets="BuildXmlRpc1_0">
+ <MSBuild Projects="xrpgen\xrpgen.vbproj"
+ Properties="Configuration=Release" />
+ </Target>
+
+ <Target Name="Test" >
+ <Copy
+ SourceFiles="ntest\iso-8859-1_response.xml;ntest\iso-8859-1_request.xml"
+ DestinationFolder="."
+ />
+ <NUnit Assemblies="$(BuildDir)\ntest.dll" />
+ <NUnit Assemblies="$(BuildDir1_0)\ntest1_0.dll" />
+ </Target>
+
+ <ItemGroup>
+ <ZipFiles Include="src/*.cs" />
+ <ZipFiles Include="src/*.sln" />
+ <ZipFiles Include="src/*.csproj" />
+ <ZipFiles Include="src/*.resx" />
+ <ZipFiles Include="src/CookComputing.XmlRpc.Targets" />
+ <ZipFiles Include="xmlrpcCF/xmlrpcCF.csproj" />
+ <ZipFiles Include="interfaces/*" />
+ <ZipFiles Include="ntest/*.cs" />
+ <ZipFiles Include="ntest/*.sln" />
+ <ZipFiles Include="ntest/*.csproj" />
+ <ZipFiles Include="ntest/*.xml" />
+ <ZipFiles Include="samples/**/*.cs" />
+ <ZipFiles Include="samples/**/*.vb" />
+ <ZipFiles Include="samples/**/*.sln" />
+ <ZipFiles Include="samples/**/*.csproj" />
+ <ZipFiles Include="samples/**/*.vbproj" />
+ <ZipFiles Include="samples/StateNameServer/server/StateNameServer.exe.config" />
+ <ZipFiles Include="samples/**/*.resx" />
+ <ZipFiles Include="samples/**/*.ashx" />
+ <ZipFiles Include="samples/**/*.ico" />
+ <ZipFiles Include="README.txt" />
+ <ZipFiles Include="xml-rpc.net.proj" />
+
+ <ZipFiles Include="$(BuildDir)/BettyApp.exe" />
+ <ZipFiles Include="$(BuildDir)/BettyAsyncApp.exe" />
+ <ZipFiles Include="$(BuildDir)/LoggingExample.exe" />
+ <ZipFiles Include="$(BuildDir)/MathApp.exe" />
+ <ZipFiles Include="$(BuildDir)/StateNameClient.exe" />
+ <ZipFiles Include="$(BuildDir)/StateNameServer.exe" />
+ <ZipFiles Include="$(BuildDir)/StateNameServer.exe.config" />
+ <ZipFiles Include="$(BuildDir)/xrpgen.exe" />
+
+ <ZipFiles Include="$(BuildDir)/CookComputing.XmlRpc.CF.dll" />
+ <ZipFiles Include="$(BuildDir)/CookComputing.XmlRpcV2.dll" />
+ <ZipFiles Include="$(BuildDir)/IStateName.dll" />
+ <ZipFiles Include="$(BuildDir)/MathService.dll" />
+ <ZipFiles Include="$(BuildDir1_0)/CookComputing.XmlRpc.dll" />
+
+ <ZipFiles Include="xrpgen/AssemblyInfo.vb" />
+ <ZipFiles Include="xrpgen/Main.vb" />
+ <ZipFiles Include="xrpgen/xrpgen.sln" />
+ <ZipFiles Include="xrpgen/XrpGen.vb" />
+ <ZipFiles Include="xrpgen/xrpgen.vbproj" />
+ </ItemGroup>
+
+ <Target Name="Package">
+ <MakeDir Directories = "$(BuildOutput)" Condition = "!Exists('$($(BuildOutput))')" />
+ <Zip Files="@(ZipFiles)"
+ ZipFileName="buildoutput\xml-rpc.net.$(Major).$(Minor).$(Build).zip">
+ </Zip>
+ </Target>
+
+ <Import Condition=" '$(username)' != '' AND '$(password)' != ''"
+ Project="upload.proj"/>
+
+</Project> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xmlrpcCF/xmlrpcCF.csproj b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xmlrpcCF/xmlrpcCF.csproj
new file mode 100644
index 0000000..56aa36a
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xmlrpcCF/xmlrpcCF.csproj
@@ -0,0 +1,246 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{57A1A190-6DCA-4611-8CB8-2A24B11A5C7A}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>CookComputing.XmlRpc.CF</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <OutputFileFolder>\Program Files\CF</OutputFileFolder>
+ <RootNamespace>CookComputing.XmlRpc</RootNamespace>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <FormFactorID>
+ </FormFactorID>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup>
+ <PlatformID>3C41C503-53EF-4c2a-8DD4-A8217CAD115E</PlatformID>
+ <PlatformFamilyName>PocketPC</PlatformFamilyName>
+ <DeployDirSuffix>$(AssemblyName)</DeployDirSuffix>
+ <TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>bin\Debug\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>0</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE;DEBUG;COMPACT_FRAMEWORK;FX1_0</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
+ <NoWarn>649</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>bin\Release\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>0</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE;COMPACT_FRAMEWORK;FX1_0</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
+ <NoWarn>649</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="mscorlib">
+ <Name>MSCorLib</Name>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ <Private>False</Private>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\src\AssemblyInfo.cs">
+ <Link>AssemblyInfo.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\GuidEx.cs">
+ <Link>GuidEx.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\IXmlRpcProxy.cs">
+ <Link>IXmlRpcProxy.cs</Link>
+ </Compile>
+ <Compile Include="..\src\util.cs">
+ <Link>util.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcAsyncResult.cs">
+ <Link>XmlRpcAsyncResult.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcBeginAttribute.cs">
+ <Link>XmlRpcBeginAttribute.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcBoolean.cs">
+ <Link>XmlRpcBoolean.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcClientProtocol.cs">
+ <Link>XmlRpcClientProtocol.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcDateTime.cs">
+ <Link>XmlRpcDateTime.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcDouble.cs">
+ <Link>XmlRpcDouble.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcEndAttribute.cs">
+ <Link>XmlRpcEndAttribute.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcException.cs">
+ <Link>XmlRpcException.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcFaultException.cs">
+ <Link>XmlRpcFaultException.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcInt.cs">
+ <Link>XmlRpcInt.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcLogger.cs">
+ <Link>XmlRpcLogger.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcMemberAttribute.cs">
+ <Link>XmlRpcMemberAttribute.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcMethodAttribute.cs">
+ <Link>XmlRpcMethodAttribute.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcMethodInfo.cs">
+ <Link>XmlRpcMethodInfo.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcMissingMappingAttribute.cs">
+ <Link>XmlRpcMissingMappingAttribute.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcNonStandard.cs">
+ <Link>XmlRpcNonStandard.cs</Link>
+ </Compile>
+ <Compile Include="..\src\XmlRpcParameterAttribute.cs">
+ <Link>XmlRpcParameterAttribute.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcParameterInfo.cs">
+ <Link>XmlRpcParameterInfo.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcRequest.cs">
+ <Link>XmlRpcRequest.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcRequestEventArgs.cs">
+ <Link>XmlRpcRequestEventArgs.cs</Link>
+ </Compile>
+ <Compile Include="..\src\XmlRpcResponse.cs">
+ <Link>XmlRpcResponse.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcResponseEventArgs.cs">
+ <Link>XmlRpcResponseEventArgs.cs</Link>
+ </Compile>
+ <Compile Include="..\src\XmlRpcReturnValueAttribute.cs">
+ <Link>XmlRpcReturnValueAttribute.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcSerializer.cs">
+ <Link>XmlRpcSerializer.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcServiceAttribute.cs">
+ <Link>XmlRpcServiceAttribute.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcServiceInfo.cs">
+ <Link>XmlRpcServiceInfo.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcStruct.cs">
+ <Link>XmlRpcStruct.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="..\src\XmlRpcUrlAttribute.cs">
+ <Link>XmlRpcUrlAttribute.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
+ <HostingProcess disable="1" />
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+ <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
+ <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+ <Target Name="BeforeBuild">
+ <CreateItem Include="..\src\AssemblyBuildNumber.cs" Condition="'$(BuildingInsideVisualStudio)' == ''">
+ <Output TaskParameter="Include" ItemName="Compile" />
+ </CreateItem>
+ </Target>
+</Project> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/AssemblyInfo.vb b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/AssemblyInfo.vb
new file mode 100644
index 0000000..ac02a3b
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/AssemblyInfo.vb
@@ -0,0 +1,34 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' 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.
+
+' Review the values of the assembly attributes
+
+<Assembly: AssemblyTitle("XrpGen")>
+<Assembly: AssemblyDescription("XML-RPC.NET proxy class code generator (driver)")>
+<Assembly: AssemblyCompany("Headblender Productions")>
+<Assembly: AssemblyProduct("XrpGen")>
+<Assembly: AssemblyCopyright("Copyright (c) 2003, Joe Bork <joe@headblender.com>")>
+<Assembly: AssemblyTrademark("")>
+<Assembly: CLSCompliant(True)>
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+<Assembly: Guid("EE5353B6-CE30-4178-A00A-B8907495E149")>
+
+<Assembly: ComVisible(False)>
+
+' 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 Build and Revision Numbers
+' by using the '*' as shown below:
+
+<Assembly: AssemblyVersion("1.0.1.*")>
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/Main.vb b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/Main.vb
new file mode 100644
index 0000000..2446a1d
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/Main.vb
@@ -0,0 +1,88 @@
+'
+'XML-RPC.NET proxy class code generator
+'Copyright (c) 2003, Joe Bork <joe@headblender.com>
+'
+'Permission is hereby granted, free of charge, to any person
+'obtaining a copy of this software and associated documentation
+'files (the "Software"), to deal in the Software without restriction,
+'including without limitation the rights to use, copy, modify, merge,
+'publish, distribute, sublicense, and/or sell copies of the Software,
+'and to permit persons to whom the Software is furnished to do so,
+'subject to the following conditions:
+'
+'The above copyright notice and this permission notice shall be
+'included in all copies or substantial portions of the Software.
+'
+'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+'EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+'OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+'NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+'HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+'WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+'OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+'DEALINGS IN THE SOFTWARE.
+'
+
+Option Strict On
+Option Explicit On
+
+
+Imports Headblender.XmlRpc
+
+Module Main
+ Private Sub ShowBanner()
+ System.Console.WriteLine("XML-RPC.NET proxy class code generator v1.0.1")
+ System.Console.WriteLine("Copyright (c) 2003, Joe Bork <joe@headblender.com>")
+ System.Console.WriteLine()
+ End Sub
+
+ Private Sub ShowUsage()
+ Console.WriteLine("Usage: xrpgen <options>")
+ Console.WriteLine("")
+ Console.WriteLine("/input:<filename> * Input source file defining the interface to proxy")
+ Console.WriteLine("")
+ Console.WriteLine("/output:<filename> * Output file to write proxy wrapper source to")
+ Console.WriteLine("")
+ Console.WriteLine("/inputlanguage:<cs|vb> Specify the input language, either CS (default) or VB")
+ Console.WriteLine("")
+ Console.WriteLine("/outputlanguage:<cs|vb> Specify the output language (CS default)")
+ Console.WriteLine("")
+ Console.WriteLine("/interface:<full.type> * Specify the full typename of the interface to proxy")
+ Console.WriteLine("")
+ Console.WriteLine("/implicit:<true|false> Indicate whether to implicitly generate ")
+ Console.WriteLine(" asynchronous proxy methods (default is False)")
+ Console.WriteLine("")
+ Console.WriteLine("/reference:<assembly> Include a reference to <assembly> for compilation;")
+ Console.WriteLine(" multiple references may be added using multiple ")
+ Console.WriteLine(" '/reference' options")
+ Console.WriteLine("")
+ Console.WriteLine("/flatten:<true|false> Indicate whether to recursively flatten the interface")
+ Console.WriteLine(" inheritance hierarchy for the root interface ")
+ Console.WriteLine(" (default False)")
+ Console.WriteLine("")
+ Console.WriteLine("(Note that options denoted by '*' are required)")
+ Console.WriteLine()
+ End Sub
+
+ Sub Main(ByVal args As String())
+ Dim opts As New XrpGenOptions()
+ Dim gen As New XrpGen()
+
+ ShowBanner()
+
+ If (args.Length = 0) Then
+ ShowUsage()
+ Return
+ End If
+
+ Try
+ opts.ParseOptions(args)
+ opts.ValidateOptions()
+
+ gen.Generate(opts, args)
+ Catch ex As ArgumentException
+ Console.WriteLine(ex.Message)
+ Return
+ End Try
+ End Sub
+End Module
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/XrpGen.vb b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/XrpGen.vb
new file mode 100644
index 0000000..98d2b56
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/XrpGen.vb
@@ -0,0 +1,444 @@
+'
+'XML-RPC.NET proxy class code generator
+'Copyright (c) 2003, Joe Bork <joe@headblender.com>
+'
+'Permission is hereby granted, free of charge, to any person
+'obtaining a copy of this software and associated documentation
+'files (the "Software"), to deal in the Software without restriction,
+'including without limitation the rights to use, copy, modify, merge,
+'publish, distribute, sublicense, and/or sell copies of the Software,
+'and to permit persons to whom the Software is furnished to do so,
+'subject to the following conditions:
+'
+'The above copyright notice and this permission notice shall be
+'included in all copies or substantial portions of the Software.
+'
+'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+'EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+'OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+'NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+'HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+'WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+'OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+'DEALINGS IN THE SOFTWARE.
+'
+
+Option Strict On
+Option Explicit On
+
+Imports System
+Imports System.Text
+Imports System.IO
+Imports System.CodeDom
+Imports System.CodeDom.Compiler
+Imports System.Reflection
+Imports System.Globalization
+Imports System.Collections
+
+Imports CookComputing.XmlRpc
+
+Imports Headblender.XmlRpc
+
+Namespace Headblender.XmlRpc
+ Public NotInheritable Class XrpGenOptions
+ Private mInputFile As String = ""
+ Private mInputTarget As String = "source"
+ Private mInputLanguage As String = "cs"
+ Private mInputInterfaceType As String = ""
+
+ Private mOutputFile As String = ""
+ Private mOutputTarget As String = "source"
+ Private mOutputLanguage As String = "cs"
+
+ Private mOutputImplicitAsync As Boolean = False
+ Private mOutputFlattenHierarchy As Boolean = False
+ Private mOutputNamespace As String = ""
+ Private mOutputProxyType As String = ""
+
+ Private mReferences As New ArrayList()
+
+ Public Sub XrpGenOptions()
+ mReferences.Add("System.dll")
+ End Sub
+
+ Public ReadOnly Property References() As ArrayList
+ Get
+ Return mReferences
+ End Get
+ End Property
+
+ Public Property InputFile() As String
+ Get
+ Return mInputFile
+ End Get
+ Set(ByVal value As String)
+ mInputFile = value
+ End Set
+ End Property
+
+ Public Property InputTarget() As String
+ Get
+ Return mInputTarget
+ End Get
+ Set(ByVal value As String)
+ mInputTarget = value
+ End Set
+ End Property
+
+ Public Property InputLanguage() As String
+ Get
+ Return mInputLanguage
+ End Get
+ Set(ByVal value As String)
+ mInputLanguage = value
+ End Set
+ End Property
+
+ Public Property InputInterfaceType() As String
+ Get
+ Return mInputInterfaceType
+ End Get
+ Set(ByVal value As String)
+ mInputInterfaceType = value
+ End Set
+ End Property
+
+ Public Property OutputFile() As String
+ Get
+ Return mOutputFile
+ End Get
+ Set(ByVal value As String)
+ mOutputFile = value
+ End Set
+ End Property
+
+ Public Property OutputTarget() As String
+ Get
+ Return mOutputTarget
+ End Get
+ Set(ByVal value As String)
+ mOutputTarget = value
+ End Set
+ End Property
+
+ Public Property OutputLanguage() As String
+ Get
+ Return mOutputLanguage
+ End Get
+ Set(ByVal value As String)
+ mOutputLanguage = value
+ End Set
+ End Property
+
+ Public Property OutputImplicitAsync() As Boolean
+ Get
+ Return mOutputImplicitAsync
+ End Get
+ Set(ByVal value As Boolean)
+ mOutputImplicitAsync = value
+ End Set
+ End Property
+
+ Public Property OutputFlattenHierarchy() As Boolean
+ Get
+ Return mOutputFlattenHierarchy
+ End Get
+ Set(ByVal value As Boolean)
+ mOutputFlattenHierarchy = value
+ End Set
+ End Property
+
+ Public Property OutputNamespace() As String
+ Get
+ Return mOutputNamespace
+ End Get
+ Set(ByVal value As String)
+ mOutputNamespace = value
+ End Set
+ End Property
+
+ Public Property OutputProxyType() As String
+ Get
+ Return mOutputProxyType
+ End Get
+ Set(ByVal value As String)
+ mOutputProxyType = value
+ End Set
+ End Property
+
+ Public Sub ValidateOptions()
+ ' --- input options
+ If (InputFile.Length = 0) Then
+ Throw New ArgumentException( _
+ "Must specify an input filename")
+ End If
+
+ InputTarget = InputTarget.ToLower(CultureInfo.InvariantCulture)
+ If (InputTarget.Length = 0) Or Not _
+ ((InputTarget = "source") Or (InputTarget = "library")) Then
+
+ Throw New ArgumentException( _
+ "Must specify either 'source' or 'library' as an input target")
+ End If
+
+ InputLanguage = InputLanguage.ToLower(CultureInfo.InvariantCulture)
+ If (InputLanguage.Length = 0) Or Not _
+ ((InputLanguage = "cs") Or (InputLanguage = "vb")) And _
+ (InputTarget = "source") Then
+
+ Throw New ArgumentException( _
+ "Must specify either 'CS' (for C#) or 'VB' (for VB) as an input language")
+ End If
+
+ If (InputInterfaceType.Length = 0) Or (InputInterfaceType.IndexOf(".") = -1) Then
+ Throw New ArgumentException( _
+ "Must specify a full name for the input interface type")
+ End If
+
+ ' --- output options
+ If (OutputFile.Length = 0) Then
+ Throw New ArgumentException( _
+ "Must specify an output filename")
+ End If
+
+ OutputTarget = OutputTarget.ToLower(CultureInfo.InvariantCulture)
+ If (OutputTarget.Length = 0) Or Not _
+ ((OutputTarget = "source") Or (OutputTarget = "library")) Then
+
+ Throw New ArgumentException( _
+ "Must specify either 'source' or 'library' as an output target")
+ End If
+
+ OutputLanguage = OutputLanguage.ToLower(CultureInfo.InvariantCulture)
+ If (OutputLanguage.Length = 0) Or Not _
+ ((OutputLanguage = "cs") Or (OutputLanguage = "vb")) And _
+ (OutputTarget = "source") Then
+
+ Throw New ArgumentException( _
+ "Must specify either 'CS' (for C#) or 'VB' (for VB) as an output language")
+ End If
+
+ ' --- TEST
+ If Not ((InputTarget = "source") And (OutputTarget = "source")) Then
+ Throw New ArgumentException( _
+ "Currently, only 'source' input and output targets supported")
+ End If
+ End Sub
+
+ Public Sub ParseOptions(ByVal args As String())
+ Dim i As Integer
+ Dim s As String
+ Dim p As Integer
+ Dim b As Boolean
+ Dim Name As String
+ Dim Value As String
+
+ For i = 0 To args.Length - 1
+ s = args(i)
+ p = s.IndexOf(":")
+
+ b = False
+ Name = ""
+ Value = ""
+ If ((s.StartsWith("/") = True) Or (s.StartsWith("-") = True)) Then
+ If ((p > 0) And (p < s.Length - 1)) Then
+ Name = s.Substring(1, p - 1)
+ Value = s.Substring(p + 1, s.Length - p - 1)
+
+ Name = Name.ToLower(CultureInfo.InvariantCulture)
+ Name = Name.Trim()
+
+ Value = Value.Replace("""", "")
+ Value = Value.Trim()
+
+ If ((Name.Length > 0) And (Value.Length > 0)) Then
+ b = True
+ End If
+ End If
+ End If
+
+ If (b = True) Then
+ Select Case Name
+ Case "input", "in"
+ InputFile = Value
+ Case "output", "out"
+ OutputFile = Value
+ Case "inputlanguage", "inputlang", "inlang"
+ InputLanguage = Value.ToLower(CultureInfo.InvariantCulture)
+ Case "outputlanguage", "outputlang", "outlang"
+ OutputLanguage = Value.ToLower(CultureInfo.InvariantCulture)
+ Case "interface", "if"
+ InputInterfaceType = Value
+ Case "implicitasync", "implicit"
+ Value = Value.ToLower(CultureInfo.InvariantCulture)
+ OutputImplicitAsync = False
+
+ If (Value = "true") Then
+ OutputImplicitAsync = True
+ End If
+ Case "flattenhierarchy", "flatten", "flat"
+ Value = Value.ToLower(CultureInfo.InvariantCulture)
+ OutputFlattenHierarchy = False
+
+ If (Value = "true") Then
+ OutputFlattenHierarchy = True
+ End If
+ Case "reference", "ref"
+ If (Value.ToLower(CultureInfo.InvariantCulture).EndsWith(".dll") = False) Then
+ Value = String.Format(CultureInfo.InvariantCulture, "{0}{1}", Value, ".dll")
+ End If
+
+ If (References.Contains(Value) = False) Then
+ References.Add(Value)
+ Else
+ Throw New ArgumentException("Duplicate assembly reference specified")
+ End If
+
+ Case Else
+ Throw New ArgumentException( _
+ String.Format( _
+ CultureInfo.InvariantCulture, _
+ "Unknown command line option: {0}", Name))
+ End Select
+ End If
+ Next
+ End Sub
+ End Class
+
+ Public NotInheritable Class XrpGen
+ Public Sub New()
+ End Sub
+
+ Public Sub Generate(ByVal opts As XrpGenOptions)
+ Generate(opts, New String() {"<< none specified >>"})
+ End Sub
+
+ Public Sub Generate(ByVal opts As XrpGenOptions, ByVal args As String())
+ opts.ValidateOptions()
+
+ ' --- create language compiler and generator
+
+ ' input source code
+ Dim xcp As CodeDomProvider = Nothing
+
+ Select Case opts.InputLanguage.ToLower(CultureInfo.InvariantCulture)
+ Case "cs"
+ xcp = New Microsoft.CSharp.CSharpCodeProvider()
+ Case "vb"
+ xcp = New Microsoft.VisualBasic.VBCodeProvider()
+ Case Else
+ Throw New Exception("Bad input language provider")
+ End Select
+
+ ' output source code
+ Dim xcg As ICodeGenerator = Nothing
+
+ Select Case opts.OutputLanguage.ToLower(CultureInfo.InvariantCulture)
+ Case "cs"
+ Dim x As New Microsoft.CSharp.CSharpCodeProvider()
+ xcg = x.CreateGenerator()
+ Case "vb"
+ Dim x As New Microsoft.VisualBasic.VBCodeProvider()
+ xcg = x.CreateGenerator()
+ Case Else
+ Throw New Exception("Bad output language generator")
+ End Select
+
+ ' --- set compiler options
+
+ Dim csc As ICodeCompiler = xcp.CreateCompiler()
+ Dim csp As New CompilerParameters()
+
+ csp.GenerateExecutable = False
+ csp.GenerateInMemory = True
+
+ '!csp.TempFiles.KeepFiles = True
+
+ Dim ro As Object = Nothing
+ For Each ro In opts.References
+ csp.ReferencedAssemblies.Add(CType(ro, String))
+ Next
+
+ ' --- compile the input source
+
+ Dim csr As CompilerResults = csc.CompileAssemblyFromFile(csp, opts.InputFile)
+
+ If (csr.Errors.Count > 0) Then
+ Dim eb As New StringBuilder()
+
+ eb.AppendFormat(CultureInfo.InvariantCulture, "Errors encountered compiling source file:{0}", Environment.NewLine)
+ eb.AppendFormat(CultureInfo.InvariantCulture, Environment.NewLine)
+
+ Dim j As Integer
+
+ For j = 0 To csr.Errors.Count - 1
+ eb.AppendFormat(CultureInfo.InvariantCulture, "{0}{1}", csr.Errors(j).ToString(), Environment.NewLine)
+ Next
+
+ Throw New ArgumentException(eb.ToString())
+ End If
+
+ ' --- generate the proxy
+
+ ' get the assembly just compiled
+ Dim a As [Assembly] = csr.CompiledAssembly
+
+ ' get the correct type from the assembly
+ Dim t As Type = a.GetType(opts.InputInterfaceType, True)
+
+ ' set proxy gen options
+ Dim xo As New XmlRpcProxyCodeGenOptions( _
+ opts.OutputNamespace, _
+ opts.OutputProxyType, _
+ opts.OutputImplicitAsync, _
+ opts.OutputFlattenHierarchy)
+
+ ' get a compuleunit for the proxy
+ Dim ccu As CodeCompileUnit = XmlRpcProxyCodeGen.CreateCodeCompileUnit( _
+ t, _
+ xcg, _
+ xo)
+
+ ' add some custom comments to the code
+ ' (code is always in the first namespace)
+ ccu.Namespaces(0).Comments.Add(New CodeCommentStatement("# # # # # #"))
+ ccu.Namespaces(0).Comments.Add(New CodeCommentStatement( _
+ String.Format( _
+ CultureInfo.InvariantCulture, _
+ "XrpGen generated file, created {0}", _
+ DateTime.Now.ToString(CultureInfo.InvariantCulture))))
+ ccu.Namespaces(0).Comments.Add(New CodeCommentStatement(""))
+ ccu.Namespaces(0).Comments.Add(New CodeCommentStatement("Command line options:"))
+
+ Dim sb As New StringBuilder()
+ Dim i As Integer
+
+ For i = 0 To args.Length - 1
+ sb.AppendFormat(CultureInfo.InvariantCulture, "{0} ", args(i))
+ Next
+ ccu.Namespaces(0).Comments.Add(New CodeCommentStatement(sb.ToString()))
+
+ ccu.Namespaces(0).Comments.Add(New CodeCommentStatement("# # # # # #"))
+ ccu.Namespaces(0).Comments.Add(New CodeCommentStatement(""))
+
+ ' set code generator options
+ Dim cgo As New CodeGeneratorOptions()
+
+ cgo.BlankLinesBetweenMembers = True
+ cgo.BracingStyle = "C"
+
+ ' create source code string from compileunit
+ Dim sw As New StringWriter(CultureInfo.InvariantCulture)
+
+ xcg.GenerateCodeFromCompileUnit(ccu, sw, cgo)
+
+ ' write the proxy source to the output file
+ Dim s As String = sw.ToString()
+
+ Dim ow As New StreamWriter(opts.OutputFile, False)
+
+ ow.Write(s)
+ ow.Close()
+ End Sub
+ End Class
+End Namespace
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/xrpgen.sln b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/xrpgen.sln
new file mode 100644
index 0000000..b308ecb
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/xrpgen.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "xrpgen", "xrpgen.vbproj", "{2824E180-366A-47CE-8172-C70DB0270017}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2824E180-366A-47CE-8172-C70DB0270017}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2824E180-366A-47CE-8172-C70DB0270017}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2824E180-366A-47CE-8172-C70DB0270017}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2824E180-366A-47CE-8172-C70DB0270017}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/xrpgen.vbproj b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/xrpgen.vbproj
new file mode 100644
index 0000000..e5db1ea
--- /dev/null
+++ b/SpacesToDasBlog/trunk/lib/xml-rpc.net.2.1.0/xrpgen/xrpgen.vbproj
@@ -0,0 +1,118 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{2824E180-366A-47CE-8172-C70DB0270017}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>xrpgen</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Exe</OutputType>
+ <OptionCompare>Binary</OptionCompare>
+ <OptionExplicit>On</OptionExplicit>
+ <OptionStrict>Off</OptionStrict>
+ <RootNamespace>
+ </RootNamespace>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <MyType>Console</MyType>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>bin\</OutputPath>
+ <DocumentationFile>
+ </DocumentationFile>
+ <BaseAddress>285212672</BaseAddress>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>
+ </DefineConstants>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <DebugSymbols>true</DebugSymbols>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>1</WarningLevel>
+ <NoWarn>42016,42017,42018,42019,42032</NoWarn>
+ <DebugType>full</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>..\bin\</OutputPath>
+ <DocumentationFile>
+ </DocumentationFile>
+ <BaseAddress>285212672</BaseAddress>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>
+ </DefineConstants>
+ <DefineDebug>false</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <DebugSymbols>false</DebugSymbols>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>1</WarningLevel>
+ <NoWarn>42016,42017,42018,42019,42032</NoWarn>
+ <DebugType>none</DebugType>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="CookComputing.XmlRpcV2">
+ <Name>CookComputing.XmlRpcV2</Name>
+ <HintPath>..\bin\CookComputing.XmlRpcV2.dll</HintPath>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Import Include="Microsoft.VisualBasic" />
+ <Import Include="System" />
+ <Import Include="System.Collections" />
+ <Import Include="System.Data" />
+ <Import Include="System.Diagnostics" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.vb">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Main.vb">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XrpGen.vb">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="My Project\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/App.config b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/App.config
new file mode 100644
index 0000000..8da40d5
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/App.config
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="username" value="mothugrecords" />
+ <add key="password" value="godzilla" />
+ <add key="Category" value="Journal" />
+ <add key="UpperLimit" value="2000" />
+ <add key="EntryIdPrefix" value="E2CAA5FD0245D158!"/>
+ <add key="BlogUrl" value="http://mothugrecords.spaces.live.com/blog/cns!"/>
+ </appSettings>
+</configuration> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Category.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Category.cs
new file mode 100644
index 0000000..eaa218d
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Category.cs
@@ -0,0 +1,13 @@
+using CookComputing.XmlRpc;
+
+namespace MetaWeblogApi {
+ /// <summary>
+ /// This struct represents the information about a category that could be returned by the
+ /// getCategories() method.
+ /// </summary>
+ [XmlRpcMissingMapping( MappingAction.Ignore )]
+ public struct Category {
+ public string description;
+ public string title;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/DasBlogWriter.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/DasBlogWriter.cs
new file mode 100644
index 0000000..369c89a
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/DasBlogWriter.cs
@@ -0,0 +1,55 @@
+using System;
+using newtelligence.DasBlog.Runtime;
+
+namespace SpacesToDasBlog.ConsoleUI {
+ public class DasBlogWriter {
+ #region Constructors
+
+ public DasBlogWriter( )
+ : this( BlogDataServiceFactory.GetService( AppDomain.CurrentDomain.BaseDirectory, null ), "Journal" ) {}
+
+ public DasBlogWriter( string defaultCategory )
+ : this( BlogDataServiceFactory.GetService( AppDomain.CurrentDomain.BaseDirectory, null ), defaultCategory ) {}
+
+ public DasBlogWriter( IBlogDataService service, String category ) {
+ _service = service;
+ _category = category;
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public void Write( ISpacesEntry spacesEntry ) {
+ Entry entry = new Entry( );
+ entry.CreatedLocalTime = spacesEntry.DateCreated;
+ entry.ModifiedLocalTime = spacesEntry.DateCreated;
+ entry.Title =
+ ( spacesEntry.Title.Length > 0
+ ? spacesEntry.Title
+ : spacesEntry.Body.Substring( 0, Math.Min( 20, spacesEntry.Body.Length ) ) );
+ entry.Content = spacesEntry.Body.Replace( Environment.NewLine, "<br />" );
+ entry.EntryId = spacesEntry.Id;
+
+ if ( spacesEntry.Categories.Count > 0 ) {
+ foreach ( string category in spacesEntry.Categories ) {
+ entry.Categories += category + ";";
+ }
+ }
+ else {
+ entry.Categories = _category;
+ }
+ entry.Author = "Mo";
+ _service.SaveEntry( entry );
+ }
+
+ #endregion
+
+ #region Private Fields
+
+ private readonly IBlogDataService _service;
+ private readonly string _category;
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/ISpacesEntry.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/ISpacesEntry.cs
new file mode 100644
index 0000000..31a438d
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/ISpacesEntry.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+
+namespace SpacesToDasBlog.ConsoleUI {
+ public interface ISpacesEntry {
+ string Id { get; }
+
+ string Title { get; }
+
+ string Body { get; }
+
+ DateTime DateCreated { get; }
+
+ IList< string > Categories { get; }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/MsnSpacesMetaWeblog.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/MsnSpacesMetaWeblog.cs
new file mode 100644
index 0000000..5e58568
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/MsnSpacesMetaWeblog.cs
@@ -0,0 +1,146 @@
+using CookComputing.XmlRpc;
+
+namespace MetaWeblogApi {
+ /// <summary>
+ /// This class can be used to programmatically interact with a Weblog on
+ /// MSN Spaces using the MetaWeblog API.
+ /// </summary>
+ [XmlRpcUrl( "https://storage.msn.com/storageservice/MetaWeblog.rpc" )]
+ public class MsnSpacesMetaWeblog : XmlRpcClientProtocol {
+ /// <summary>
+ /// Returns the most recent draft and non-draft blog posts sorted in descending order by publish date.
+ /// </summary>
+ /// <param name="blogid"> This should be the string MyBlog, which indicates that the post is being created in the user’s blog. </param>
+ /// <param name="username"> The name of the user’s space. </param>
+ /// <param name="password"> The user’s secret word. </param>
+ /// <param name="numberOfPosts"> The number of posts to return. The maximum value is 20. </param>
+ /// <returns></returns>
+ [XmlRpcMethod( "metaWeblog.getRecentPosts" )]
+ public Post[] getRecentPosts(
+ string blogid,
+ string username,
+ string password,
+ int numberOfPosts ) {
+ return ( Post[] )Invoke( "getRecentPosts", new object[] {blogid, username, password, numberOfPosts} );
+ }
+
+ /// <summary>
+ /// Posts a new entry to a blog.
+ /// </summary>
+ /// <param name="blogid"> This should be the string MyBlog, which indicates that the post is being created in the user’s blog. </param>
+ /// <param name="username"> The name of the user’s space. </param>
+ /// <param name="password"> The user’s secret word. </param>
+ /// <param name="content"> A struct representing the content to update. </param>
+ /// <param name="publish"> If false, this is a draft post. </param>
+ /// <returns> The postid of the newly-created post. </returns>
+ [XmlRpcMethod( "metaWeblog.newPost" )]
+ public string newPost(
+ string blogid,
+ string username,
+ string password,
+ Post content,
+ bool publish ) {
+ return ( string )Invoke( "newPost", new object[] {blogid, username, password, content, publish} );
+ }
+
+ /// <summary>
+ /// Edits an existing entry on a blog.
+ /// </summary>
+ /// <param name="postid"> The ID of the post to update. </param>
+ /// <param name="username"> The name of the user’s space. </param>
+ /// <param name="password"> The user’s secret word. </param>
+ /// <param name="content"> A struct representing the content to update. </param>
+ /// <param name="publish"> If false, this is a draft post. </param>
+ /// <returns> Always returns true. </returns>
+ [XmlRpcMethod( "metaWeblog.editPost" )]
+ public bool editPost(
+ string postid,
+ string username,
+ string password,
+ Post content,
+ bool publish ) {
+ return ( bool )Invoke( "editPost", new object[] {postid, username, password, content, publish} );
+ }
+
+ /// <summary>
+ /// Deletes a post from the blog.
+ /// </summary>
+ /// <param name="appKey"> This value is ignored. </param>
+ /// <param name="postid"> The ID of the post to update. </param>
+ /// <param name="username"> The name of the user’s space. </param>
+ /// <param name="password"> The user’s secret word. </param>
+ /// <param name="publish"> This value is ignored. </param>
+ /// <returns> Always returns true. </returns>
+ [XmlRpcMethod( "blogger.deletePost" )]
+ public bool deletePost(
+ string appKey,
+ string postid,
+ string username,
+ string password,
+ bool publish ) {
+ return ( bool )Invoke( "deletePost", new object[] {appKey, postid, username, password, publish} );
+ }
+
+ /// <summary>
+ /// Returns information about the user’s space. An empty array is returned if the user does not have a space.
+ /// </summary>
+ /// <param name="appKey"> This value is ignored. </param>
+ /// <param name="username"> The name of the user’s space. </param>
+ /// <returns> An array of structs that represents each of the user’s blogs. The array will contain a maximum of one struct, since a user can only have a single space with a single blog. </returns>
+ /// <param name="password"></param>
+ [XmlRpcMethod( "blogger.getUsersBlogs" )]
+ public UserBlog[] getUsersBlogs(
+ string appKey,
+ string username,
+ string password ) {
+ return ( UserBlog[] )Invoke( "getUsersBlogs", new object[] {appKey, username, password} );
+ }
+
+ /// <summary>
+ /// Returns basic user info (name, e-mail, userid, and so on).
+ /// </summary>
+ /// <param name="appKey"> This value is ignored. </param>
+ /// <param name="username"> The name of the user’s space. </param>
+ /// <returns> A struct containing profile information about the user.
+ /// Each struct will contain the following fields: nickname, userid, url, e-mail,
+ /// lastname, and firstname. </returns>
+ /// <param name="password"></param>
+ [XmlRpcMethod( "blogger.getUserInfo" )]
+ public UserInfo getUserInfo(
+ string appKey,
+ string username,
+ string password ) {
+ return ( UserInfo )Invoke( "getUserInfo", new object[] {appKey, username, password} );
+ }
+
+ /// <summary>
+ /// Returns a specific entry from a blog.
+ /// </summary>
+ /// <param name="postid"> The ID of the post to update. </param>
+ /// <param name="username"> The name of the user’s space. </param>
+ /// <param name="password"> The user’s secret word. </param>
+ /// <returns> Always returns true. </returns>
+ [XmlRpcMethod( "metaWeblog.getPost" )]
+ public Post getPost(
+ string postid,
+ string username,
+ string password ) {
+ return ( Post )Invoke( "getPost", new object[] {postid, username, password} );
+ }
+
+ /// <summary>
+ /// Returns the list of categories that have been used in the blog.
+ /// </summary>
+ /// <param name="blogid"> This should be the string MyBlog, which indicates that the post is being created in the user’s blog. </param>
+ /// <param name="username"> The name of the user’s space. </param>
+ /// <param name="password"> The user’s secret word. </param>
+ /// <returns> An array of structs that contains one struct for each category. Each category struct will contain a description field that contains the name of the category. </returns>
+ [XmlRpcMethod( "metaWeblog.getCategories" )]
+ public Category[] getCategories(
+ string blogid,
+ string username,
+ string password ) {
+ return ( Category[] )Invoke( "getCategories", new object[] {blogid, username, password} );
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Post.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Post.cs
new file mode 100644
index 0000000..2e9c818
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Post.cs
@@ -0,0 +1,17 @@
+using System;
+using CookComputing.XmlRpc;
+
+namespace MetaWeblogApi {
+ /// <summary>
+ /// This struct represents the information about a post that could be returned by the
+ /// editPost(), getRecentPosts() and getPost() methods.
+ /// </summary>
+ [XmlRpcMissingMapping( MappingAction.Ignore )]
+ public struct Post {
+ public DateTime dateCreated;
+ public string description;
+ public string title;
+ public string postid;
+ public string[] categories;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Program.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Program.cs
new file mode 100644
index 0000000..216499d
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Program.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Net;
+using MetaWeblogApi;
+
+namespace SpacesToDasBlog.ConsoleUI {
+ internal class Program {
+ /// <summary> The main entry point for the application. </summary>
+ [STAThread]
+ private static void Main( ) {
+ MsnSpacesMetaWeblog mw = new MsnSpacesMetaWeblog( );
+ SpaceSettings settings = new SpaceSettings( );
+
+ mw.Credentials = new NetworkCredential( settings.Username, settings.Password );
+
+ DasBlogWriter dasBlogWriter = new DasBlogWriter( settings.DefaultCategory );
+ SpaceHtmlParser parser = new SpaceHtmlParser( settings.BlogUrl );
+ for ( int i = 0; i < settings.UpperLimit; i++ ) {
+ string entryId = settings.EntryIdPrefix + i;
+ try {
+ Post post = mw.getPost( entryId, settings.Username, settings.Password );
+ post.dateCreated = parser.GetEntryDate( entryId );
+
+ dasBlogWriter.Write( new SpacesEntry( post ) );
+ Console.WriteLine( "Success: Entry Id " + entryId );
+ }
+ catch {
+ Console.WriteLine( "Failed to retrieve post with ID: " + entryId );
+ }
+ }
+ Console.ReadLine( );
+ }
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Properties/AssemblyInfo.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..c07e7e4
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("SpacesToDasBlog.Console")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SpacesToDasBlog.Console")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("06aa1924-c4b2-4fba-813d-f526e49f5d1b")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpaceHtmlParser.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpaceHtmlParser.cs
new file mode 100644
index 0000000..6246bf9
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpaceHtmlParser.cs
@@ -0,0 +1,73 @@
+using System;
+using System.IO;
+using System.Net;
+
+namespace SpacesToDasBlog.ConsoleUI {
+ public class SpaceHtmlParser {
+ public SpaceHtmlParser( string blogUrl ) {
+ _blogUrl = blogUrl;
+ }
+
+ public string BlogUrl {
+ get { return _blogUrl; }
+ }
+
+ public DateTime GetEntryDate( string entryId ) {
+ return GetEntryDate( entryId, GetPageHtml( entryId ) );
+ }
+
+ private static string GetTime( string html ) {
+ int start = html.IndexOf( " AM" );
+ start = ( start == -1 ) ? html.IndexOf( " PM" ) : start;
+ start = start - 7;
+ int end = start + 10;
+
+ return html.Substring( start, end - start );
+ }
+
+ private static string GetMonthAndYear( string entryId, string responseFromServer ) {
+ responseFromServer = responseFromServer.Substring( responseFromServer.IndexOf( "LastMDatecns!" + entryId ), 50 );
+ int start = responseFromServer.IndexOf( ">" ) + 1;
+ int end = responseFromServer.IndexOf( "<" );
+ return responseFromServer.Substring( start, end - start ) + " 2005";
+ }
+
+ private static DateTime GetEntryDate( string entryId, string responseFromServer ) {
+ string dateTime = GetMonthAndYear( entryId, responseFromServer ) + " " + GetTime( responseFromServer );
+ DateTime result;
+ if ( DateTime.TryParse( dateTime, out result ) ) {
+ return result;
+ }
+ return DateTime.MinValue;
+ }
+
+ private string GetPageHtml( string entryId ) {
+ WebResponse response = null;
+ StreamReader reader = null;
+ string responseFromServer;
+ try {
+ WebRequest request = WebRequest.Create( _blogUrl + entryId + ".entry" );
+ response = request.GetResponse( );
+ //Console.WriteLine( ( ( HttpWebResponse )response ).StatusDescription );
+
+ Stream dataStream = response.GetResponseStream( );
+
+ reader = new StreamReader( dataStream );
+ responseFromServer = reader.ReadToEnd( );
+ //Console.WriteLine( responseFromServer );
+ }
+ finally {
+ if ( reader != null ) {
+ reader.Close( );
+ }
+ if ( response != null ) {
+ response.Close( );
+ }
+ }
+
+ return responseFromServer;
+ }
+
+ private string _blogUrl;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpaceSettings.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpaceSettings.cs
new file mode 100644
index 0000000..d4bb0cf
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpaceSettings.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Configuration;
+
+namespace SpacesToDasBlog.ConsoleUI {
+ public class SpaceSettings {
+ public SpaceSettings( )
+ : this( ConfigurationManager.AppSettings[ "username" ],
+ ConfigurationManager.AppSettings[ "password" ],
+ ConfigurationManager.AppSettings[ "Category" ],
+ Convert.ToInt32( ConfigurationManager.AppSettings[ "UpperLimit" ] ),
+ ConfigurationManager.AppSettings[ "EntryIdPrefix" ],
+ ConfigurationManager.AppSettings[ "BlogUrl" ] ) {}
+
+ public SpaceSettings( string username, string password, string defaultCategory, int upperLimit, string entryIdPrefix,
+ string blogUrl ) {
+ _username = username;
+ _password = password;
+ _defaultCategory = defaultCategory;
+ _upperLimit = upperLimit;
+ _entryIdPrefix = entryIdPrefix;
+ _blogUrl = blogUrl;
+ }
+
+ public string Username {
+ get { return _username; }
+ }
+
+ public string Password {
+ get { return _password; }
+ }
+
+ public string DefaultCategory {
+ get { return _defaultCategory; }
+ }
+
+ public int UpperLimit {
+ get { return _upperLimit; }
+ }
+
+ public string EntryIdPrefix {
+ get { return _entryIdPrefix; }
+ }
+
+ public string BlogUrl {
+ get { return _blogUrl; }
+ }
+
+ private string _username;
+ private string _password;
+ private string _defaultCategory;
+ private int _upperLimit;
+ private string _entryIdPrefix;
+ private string _blogUrl;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpacesEntry.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpacesEntry.cs
new file mode 100644
index 0000000..fb57b45
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpacesEntry.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using MetaWeblogApi;
+
+namespace SpacesToDasBlog.ConsoleUI {
+ internal class SpacesEntry : ISpacesEntry {
+ public SpacesEntry( Post post )
+ : this( post.postid, post.title, post.description, post.dateCreated, post.categories ) {}
+
+ public SpacesEntry( string postid, string title, string description, DateTime dateCreated, string[] categories ) {
+ _id = postid;
+ _title = title;
+ _body = description;
+ _dateCreated = dateCreated;
+ _categories = new List< string >( categories );
+ }
+
+ public string Id {
+ get { return _id; }
+ }
+
+ public string Title {
+ get { return _title; }
+ }
+
+ public string Body {
+ get { return _body; }
+ }
+
+ public DateTime DateCreated {
+ get { return _dateCreated; }
+ }
+
+ public IList< string > Categories {
+ get { return _categories; }
+ }
+
+ private readonly string _id;
+ private readonly string _title;
+ private readonly string _body;
+ private readonly DateTime _dateCreated;
+ private readonly IList< string > _categories;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpacesToDasBlog.ConsoleUI.csproj b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpacesToDasBlog.ConsoleUI.csproj
new file mode 100644
index 0000000..55f22ee
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/SpacesToDasBlog.ConsoleUI.csproj
@@ -0,0 +1,71 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{CA56AAAF-6ED2-4CEC-B92E-9E1D7DD83B90}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SpacesToDasBlog.ConsoleUI</RootNamespace>
+ <AssemblyName>SpacesToDasBlog.ConsoleUI</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="CookComputing.XmlRpc, Version=2.1.0.3, Culture=neutral, PublicKeyToken=a7d6e17aa302004d">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\lib\xml-rpc.net.2.1.0\bin1_0\CookComputing.XmlRpc.dll</HintPath>
+ </Reference>
+ <Reference Include="newtelligence.DasBlog.Runtime, Version=1.9.6264.0, Culture=neutral">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\lib\newtelligence.DasBlog.Runtime.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.configuration" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Category.cs" />
+ <Compile Include="DasBlogWriter.cs" />
+ <Compile Include="ISpacesEntry.cs" />
+ <Compile Include="MsnSpacesMetaWeblog.cs">
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="Post.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SpaceHtmlParser.cs" />
+ <Compile Include="SpacesEntry.cs" />
+ <Compile Include="SpaceSettings.cs" />
+ <Compile Include="UserBlog.cs" />
+ <Compile Include="UserInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/UserBlog.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/UserBlog.cs
new file mode 100644
index 0000000..eace38a
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/UserBlog.cs
@@ -0,0 +1,13 @@
+using CookComputing.XmlRpc;
+
+namespace MetaWeblogApi {
+ /// <summary>
+ /// This struct represents information about a user's blog.
+ /// </summary>
+ [XmlRpcMissingMapping( MappingAction.Ignore )]
+ public struct UserBlog {
+ public string url;
+ public string blogid;
+ public string blogName;
+ }
+} \ No newline at end of file
diff --git a/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/UserInfo.cs b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/UserInfo.cs
new file mode 100644
index 0000000..3d03374
--- /dev/null
+++ b/SpacesToDasBlog/trunk/src/app/SpacesToDasBlog.Console/UserInfo.cs
@@ -0,0 +1,17 @@
+using CookComputing.XmlRpc;
+
+namespace MetaWeblogApi {
+ /// <summary>
+ /// This struct represents information about a user.
+ /// </summary>
+ [XmlRpcMissingMapping( MappingAction.Ignore )]
+ public struct UserInfo {
+ public string url;
+ public string blogid;
+ public string blogName;
+ public string firstname;
+ public string lastname;
+ public string email;
+ public string nickname;
+ }
+} \ No newline at end of file