aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/AppearanceTableMapper.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/AppearanceTableMapper.cs244
1 files changed, 0 insertions, 244 deletions
diff --git a/OpenSim/Region/Environment/Modules/AppearanceTableMapper.cs b/OpenSim/Region/Environment/Modules/AppearanceTableMapper.cs
deleted file mode 100644
index 5353952..0000000
--- a/OpenSim/Region/Environment/Modules/AppearanceTableMapper.cs
+++ /dev/null
@@ -1,244 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.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/*
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework;
33using OpenSim.Data.Base;
34
35namespace OpenSim.Region.Environment.Modules
36{
37
38 public class AppearanceRowMapper : BaseRowMapper<AvatarAppearance>
39 {
40 public AppearanceRowMapper(BaseSchema schema, AvatarAppearance obj)
41 : base(schema, obj)
42 {
43 }
44 }
45
46 public class AppearanceTableMapper : BaseTableMapper<AppearanceRowMapper, Guid>
47 {
48 public AppearanceTableMapper(BaseDatabaseConnector database, string tableName)
49 : base(database, tableName)
50 {
51 BaseSchema<AppearanceRowMapper> rowMapperSchema = new BaseSchema<AppearanceRowMapper>(this);
52 m_schema = rowMapperSchema;
53
54 m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("UUID",
55 delegate(AppearanceRowMapper mapper) { return mapper.Object.ScenePresenceID.UUID; },
56 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.ScenePresenceID = new libsecondlife.LLUUID(value.ToString()); });
57
58 rowMapperSchema.AddMapping<uint>("Serial",
59 delegate(AppearanceRowMapper mapper) { return (uint)mapper.Object.WearablesSerial; },
60 delegate(AppearanceRowMapper mapper, uint value) { mapper.Object.WearablesSerial = (int)value; });
61
62 rowMapperSchema.AddMapping<Guid>("WearableItem0",
63 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[0].ItemID.UUID; },
64 delegate(AppearanceRowMapper mapper, Guid value)
65 {
66 if (mapper.Object.Wearables == null)
67 {
68 mapper.Object.Wearables = new OpenSim.Framework.AvatarWearable[13];
69 for (int i = 0; i < 13; i++)
70 {
71 mapper.Object.Wearables[i] = new AvatarWearable();
72 }
73 }
74 mapper.Object.Wearables[0].ItemID = new libsecondlife.LLUUID(value.ToString());
75 });
76
77 rowMapperSchema.AddMapping<Guid>("WearableAsset0",
78 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[0].AssetID.UUID; },
79 delegate(AppearanceRowMapper mapper, Guid value)
80 { mapper.Object.Wearables[0].AssetID = new libsecondlife.LLUUID(value.ToString()); });
81
82 rowMapperSchema.AddMapping<Guid>("WearableItem1",
83 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[1].ItemID.UUID; },
84 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[1].ItemID = new libsecondlife.LLUUID(value.ToString()); });
85
86 rowMapperSchema.AddMapping<Guid>("WearableAsset1",
87 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[1].AssetID.UUID; },
88 delegate(AppearanceRowMapper mapper, Guid value)
89 { mapper.Object.Wearables[1].AssetID = new libsecondlife.LLUUID(value.ToString()); });
90
91 rowMapperSchema.AddMapping<Guid>("WearableItem2",
92 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[2].ItemID.UUID; },
93 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[2].ItemID = new libsecondlife.LLUUID(value.ToString()); });
94
95 rowMapperSchema.AddMapping<Guid>("WearableAsset2",
96 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[2].AssetID.UUID; },
97 delegate(AppearanceRowMapper mapper, Guid value)
98 { mapper.Object.Wearables[2].AssetID = new libsecondlife.LLUUID(value.ToString()); });
99
100 rowMapperSchema.AddMapping<Guid>("WearableItem3",
101 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[3].ItemID.UUID; },
102 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[3].ItemID = new libsecondlife.LLUUID(value.ToString()); });
103
104 rowMapperSchema.AddMapping<Guid>("WearableAsset3",
105 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[3].AssetID.UUID; },
106 delegate(AppearanceRowMapper mapper, Guid value)
107 { mapper.Object.Wearables[3].AssetID = new libsecondlife.LLUUID(value.ToString()); });
108
109 rowMapperSchema.AddMapping<Guid>("WearableItem4",
110 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[4].ItemID.UUID; },
111 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[4].ItemID = new libsecondlife.LLUUID(value.ToString()); });
112
113 rowMapperSchema.AddMapping<Guid>("WearableAsset4",
114 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[4].AssetID.UUID; },
115 delegate(AppearanceRowMapper mapper, Guid value)
116 { mapper.Object.Wearables[4].AssetID = new libsecondlife.LLUUID(value.ToString()); });
117
118 rowMapperSchema.AddMapping<Guid>("WearableItem5",
119 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[5].ItemID.UUID; },
120 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[5].ItemID = new libsecondlife.LLUUID(value.ToString()); });
121
122 rowMapperSchema.AddMapping<Guid>("WearableAsset5",
123 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[5].AssetID.UUID; },
124 delegate(AppearanceRowMapper mapper, Guid value)
125 { mapper.Object.Wearables[5].AssetID = new libsecondlife.LLUUID(value.ToString()); });
126
127 rowMapperSchema.AddMapping<Guid>("WearableItem6",
128 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[6].ItemID.UUID; },
129 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[6].ItemID = new libsecondlife.LLUUID(value.ToString()); });
130
131 rowMapperSchema.AddMapping<Guid>("WearableAsset6",
132 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[6].AssetID.UUID; },
133 delegate(AppearanceRowMapper mapper, Guid value)
134 { mapper.Object.Wearables[6].AssetID = new libsecondlife.LLUUID(value.ToString()); });
135
136 rowMapperSchema.AddMapping<Guid>("WearableItem7",
137 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[7].ItemID.UUID; },
138 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[7].ItemID = new libsecondlife.LLUUID(value.ToString()); });
139
140 rowMapperSchema.AddMapping<Guid>("WearableAsset7",
141 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[7].AssetID.UUID; },
142 delegate(AppearanceRowMapper mapper, Guid value)
143 { mapper.Object.Wearables[7].AssetID = new libsecondlife.LLUUID(value.ToString()); });
144
145 rowMapperSchema.AddMapping<Guid>("WearableItem8",
146 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[8].ItemID.UUID; },
147 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[8].ItemID = new libsecondlife.LLUUID(value.ToString()); });
148
149 rowMapperSchema.AddMapping<Guid>("WearableAsset8",
150 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[8].AssetID.UUID; },
151 delegate(AppearanceRowMapper mapper, Guid value)
152 { mapper.Object.Wearables[8].AssetID = new libsecondlife.LLUUID(value.ToString()); });
153
154 rowMapperSchema.AddMapping<Guid>("WearableItem9",
155 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[9].ItemID.UUID; },
156 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[9].ItemID = new libsecondlife.LLUUID(value.ToString()); });
157
158 rowMapperSchema.AddMapping<Guid>("WearableAsset9",
159 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[9].AssetID.UUID; },
160 delegate(AppearanceRowMapper mapper, Guid value)
161 { mapper.Object.Wearables[9].AssetID = new libsecondlife.LLUUID(value.ToString()); });
162
163 rowMapperSchema.AddMapping<Guid>("WearableItem10",
164 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[10].ItemID.UUID; },
165 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[10].ItemID = new libsecondlife.LLUUID(value.ToString()); });
166
167 rowMapperSchema.AddMapping<Guid>("WearableAsset10",
168 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[10].AssetID.UUID; },
169 delegate(AppearanceRowMapper mapper, Guid value)
170 { mapper.Object.Wearables[10].AssetID = new libsecondlife.LLUUID(value.ToString()); });
171
172 rowMapperSchema.AddMapping<Guid>("WearableItem11",
173 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[11].ItemID.UUID; },
174 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[11].ItemID = new libsecondlife.LLUUID(value.ToString()); });
175
176 rowMapperSchema.AddMapping<Guid>("WearableAsset11",
177 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[11].AssetID.UUID; },
178 delegate(AppearanceRowMapper mapper, Guid value)
179 { mapper.Object.Wearables[11].AssetID = new libsecondlife.LLUUID(value.ToString()); });
180
181 rowMapperSchema.AddMapping<Guid>("WearableItem12",
182 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[12].ItemID.UUID; },
183 delegate(AppearanceRowMapper mapper, Guid value) { mapper.Object.Wearables[12].ItemID = new libsecondlife.LLUUID(value.ToString()); });
184
185 rowMapperSchema.AddMapping<Guid>("WearableAsset12",
186 delegate(AppearanceRowMapper mapper) { return mapper.Object.Wearables[12].AssetID.UUID; },
187 delegate(AppearanceRowMapper mapper, Guid value)
188 { mapper.Object.Wearables[12].AssetID = new libsecondlife.LLUUID(value.ToString()); });
189
190 }
191
192 public bool Add(Guid userID, AvatarAppearance appearance)
193 {
194 AppearanceRowMapper mapper = CreateRowMapper(appearance);
195 return Add(mapper);
196 }
197
198 public bool Update(Guid userID, AvatarAppearance appearance)
199 {
200 AppearanceRowMapper mapper = CreateRowMapper(appearance);
201 return Update(appearance.ScenePresenceID.UUID, mapper);
202 }
203
204 protected AppearanceRowMapper CreateRowMapper(AvatarAppearance appearance)
205 {
206 return new AppearanceRowMapper(m_schema, appearance);
207 }
208
209 protected AppearanceRowMapper CreateRowMapper()
210 {
211 return CreateRowMapper(new AvatarAppearance());
212 }
213
214 protected AppearanceRowMapper FromReader(BaseDataReader reader, AvatarAppearance appearance)
215 {
216 AppearanceRowMapper mapper = CreateRowMapper(appearance);
217 mapper.FillObject(reader);
218 return mapper;
219 }
220
221 public override AppearanceRowMapper FromReader(BaseDataReader reader)
222 {
223 AppearanceRowMapper mapper = CreateRowMapper();
224 mapper.FillObject(reader);
225 return mapper;
226 }
227
228 public bool TryGetValue(Guid presenceID, out AvatarAppearance val)
229 {
230 AppearanceRowMapper mapper;
231 if (TryGetValue(presenceID, out mapper))
232 {
233 val = mapper.Object;
234 return true;
235 }
236 else
237 {
238 val = null;
239 return false;
240 }
241 }
242 }
243
244}*/