diff options
author | Adam Frisby | 2007-07-11 08:02:47 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:02:47 +0000 |
commit | 5c7ffdde0b9642a42e8f5987e06eb01220ff7776 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /Common/XmlRpcCS/XmlRpcResponse.cs | |
parent | Who would have known that the only way of specifying utf-8 without preamble, ... (diff) | |
download | opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.zip opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.gz opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.bz2 opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.xz |
* Wiping trunk in prep for Sugilite
Diffstat (limited to 'Common/XmlRpcCS/XmlRpcResponse.cs')
-rw-r--r-- | Common/XmlRpcCS/XmlRpcResponse.cs | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/Common/XmlRpcCS/XmlRpcResponse.cs b/Common/XmlRpcCS/XmlRpcResponse.cs deleted file mode 100644 index 414998e..0000000 --- a/Common/XmlRpcCS/XmlRpcResponse.cs +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | namespace Nwc.XmlRpc | ||
29 | { | ||
30 | using System; | ||
31 | using System.Collections; | ||
32 | using System.IO; | ||
33 | using System.Xml; | ||
34 | |||
35 | /// <summary>Class designed to represent an XML-RPC response.</summary> | ||
36 | public class XmlRpcResponse | ||
37 | { | ||
38 | private Object _value; | ||
39 | /// <summary><c>bool</c> indicating if this response represents a fault.</summary> | ||
40 | public bool IsFault; | ||
41 | |||
42 | /// <summary>Basic constructor</summary> | ||
43 | public XmlRpcResponse() | ||
44 | { | ||
45 | Value = null; | ||
46 | IsFault = false; | ||
47 | } | ||
48 | |||
49 | /// <summary>Constructor for a fault.</summary> | ||
50 | /// <param name="code"><c>int</c> the numeric faultCode value.</param> | ||
51 | /// <param name="message"><c>String</c> the faultString value.</param> | ||
52 | public XmlRpcResponse(int code, String message) | ||
53 | : this() | ||
54 | { | ||
55 | SetFault(code, message); | ||
56 | } | ||
57 | |||
58 | /// <summary>The data value of the response, may be fault data.</summary> | ||
59 | public Object Value | ||
60 | { | ||
61 | get { return _value; } | ||
62 | set | ||
63 | { | ||
64 | IsFault = false; | ||
65 | _value = value; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | /// <summary>The faultCode if this is a fault.</summary> | ||
70 | public int FaultCode | ||
71 | { | ||
72 | get | ||
73 | { | ||
74 | if (!IsFault) | ||
75 | return 0; | ||
76 | else | ||
77 | return (int)((Hashtable)_value)[XmlRpcXmlTokens.FAULT_CODE]; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | /// <summary>The faultString if this is a fault.</summary> | ||
82 | public String FaultString | ||
83 | { | ||
84 | get | ||
85 | { | ||
86 | if (!IsFault) | ||
87 | return ""; | ||
88 | else | ||
89 | return (String)((Hashtable)_value)[XmlRpcXmlTokens.FAULT_STRING]; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | /// <summary>Set this response to be a fault.</summary> | ||
94 | /// <param name="code"><c>int</c> the numeric faultCode value.</param> | ||
95 | /// <param name="message"><c>String</c> the faultString value.</param> | ||
96 | public void SetFault(int code, String message) | ||
97 | { | ||
98 | Hashtable fault = new Hashtable(); | ||
99 | fault.Add("faultCode", code); | ||
100 | fault.Add("faultString", message); | ||
101 | Value = fault; | ||
102 | IsFault = true; | ||
103 | } | ||
104 | |||
105 | /// <summary>Form a useful string representation of the object, in this case the XML response.</summary> | ||
106 | /// <returns><c>String</c> The XML serialized XML-RPC response.</returns> | ||
107 | override public String ToString() | ||
108 | { | ||
109 | return XmlRpcResponseSerializer.Singleton.Serialize(this); | ||
110 | } | ||
111 | } | ||
112 | } | ||