diff options
author | Diva Canto | 2014-06-01 10:06:26 -0700 |
---|---|---|
committer | Diva Canto | 2014-06-01 10:06:26 -0700 |
commit | 2ff9ea3f8038653135c284cc0c93d88690db9a22 (patch) | |
tree | 34448f055a3577311e147503536260337a8d4719 /OpenSim/Framework/EstateBan.cs | |
parent | Fix a bug where estate not found would result in a dummy estate record with e... (diff) | |
download | opensim-SC-2ff9ea3f8038653135c284cc0c93d88690db9a22.zip opensim-SC-2ff9ea3f8038653135c284cc0c93d88690db9a22.tar.gz opensim-SC-2ff9ea3f8038653135c284cc0c93d88690db9a22.tar.bz2 opensim-SC-2ff9ea3f8038653135c284cc0c93d88690db9a22.tar.xz |
Fixed a few things pertaining to interfacing with the estate service. Specifically, StoreEstateSettings was not being used anywhere; instead EstatSetting.Save was being called, but that method is a trigger to the DB-layer code directly, which, besides being wrong, was making it impossible to replace the service with a remote connector.
Also added more packing/unpacking code.
Diffstat (limited to 'OpenSim/Framework/EstateBan.cs')
-rw-r--r-- | OpenSim/Framework/EstateBan.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/OpenSim/Framework/EstateBan.cs b/OpenSim/Framework/EstateBan.cs index de9ebf6..ebed794 100644 --- a/OpenSim/Framework/EstateBan.cs +++ b/OpenSim/Framework/EstateBan.cs | |||
@@ -25,6 +25,10 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | |||
28 | using OpenMetaverse; | 32 | using OpenMetaverse; |
29 | 33 | ||
30 | namespace OpenSim.Framework | 34 | namespace OpenSim.Framework |
@@ -111,5 +115,50 @@ namespace OpenSim.Framework | |||
111 | } | 115 | } |
112 | } | 116 | } |
113 | 117 | ||
118 | public EstateBan() { } | ||
119 | |||
120 | public Dictionary<string, object> ToMap() | ||
121 | { | ||
122 | Dictionary<string, object> map = new Dictionary<string, object>(); | ||
123 | PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); | ||
124 | foreach (PropertyInfo p in properties) | ||
125 | map[p.Name] = p.GetValue(this, null); | ||
126 | |||
127 | return map; | ||
128 | } | ||
129 | |||
130 | public EstateBan(Dictionary<string, object> map) | ||
131 | { | ||
132 | foreach (KeyValuePair<string, object> kvp in map) | ||
133 | { | ||
134 | PropertyInfo p = this.GetType().GetProperty(kvp.Key, BindingFlags.Public | BindingFlags.Instance); | ||
135 | if (p == null) | ||
136 | continue; | ||
137 | object value = p.GetValue(this, null); | ||
138 | if (value is String) | ||
139 | p.SetValue(this, map[p.Name], null); | ||
140 | else if (value is UInt32) | ||
141 | p.SetValue(this, UInt32.Parse((string)map[p.Name]), null); | ||
142 | else if (value is Boolean) | ||
143 | p.SetValue(this, Boolean.Parse((string)map[p.Name]), null); | ||
144 | else if (value is UUID) | ||
145 | p.SetValue(this, UUID.Parse((string)map[p.Name]), null); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | |||
150 | /// <summary> | ||
151 | /// For debugging | ||
152 | /// </summary> | ||
153 | /// <returns></returns> | ||
154 | public override string ToString() | ||
155 | { | ||
156 | Dictionary<string, object> map = ToMap(); | ||
157 | string result = string.Empty; | ||
158 | foreach (KeyValuePair<string, object> kvp in map) | ||
159 | result += string.Format("{0}: {1} {2}", kvp.Key, kvp.Value, Environment.NewLine); | ||
160 | |||
161 | return result; | ||
162 | } | ||
114 | } | 163 | } |
115 | } | 164 | } |