diff options
author | UbitUmarov | 2015-09-01 11:43:07 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 11:43:07 +0100 |
commit | fb78b182520fc9bb0f971afd0322029c70278ea6 (patch) | |
tree | b4e30d383938fdeef8c92d1d1c2f44bb61d329bd /OpenSim/Framework/InventoryItemBase.cs | |
parent | lixo (diff) | |
parent | Mantis #7713: fixed bug introduced by 1st MOSES patch. (diff) | |
download | opensim-SC-fb78b182520fc9bb0f971afd0322029c70278ea6.zip opensim-SC-fb78b182520fc9bb0f971afd0322029c70278ea6.tar.gz opensim-SC-fb78b182520fc9bb0f971afd0322029c70278ea6.tar.bz2 opensim-SC-fb78b182520fc9bb0f971afd0322029c70278ea6.tar.xz |
Merge remote-tracking branch 'os/master'
Diffstat (limited to 'OpenSim/Framework/InventoryItemBase.cs')
-rw-r--r-- | OpenSim/Framework/InventoryItemBase.cs | 419 |
1 files changed, 419 insertions, 0 deletions
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs new file mode 100644 index 0000000..f9fd752 --- /dev/null +++ b/OpenSim/Framework/InventoryItemBase.cs | |||
@@ -0,0 +1,419 @@ | |||
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 OpenSimulator 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 | using System; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Framework | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Inventory Item - contains all the properties associated with an individual inventory piece. | ||
35 | /// </summary> | ||
36 | public class InventoryItemBase : InventoryNodeBase, ICloneable | ||
37 | { | ||
38 | /// <value> | ||
39 | /// The inventory type of the item. This is slightly different from the asset type in some situations. | ||
40 | /// </value> | ||
41 | public int InvType | ||
42 | { | ||
43 | get | ||
44 | { | ||
45 | return m_invType; | ||
46 | } | ||
47 | |||
48 | set | ||
49 | { | ||
50 | m_invType = value; | ||
51 | } | ||
52 | } | ||
53 | protected int m_invType; | ||
54 | |||
55 | /// <value> | ||
56 | /// The folder this item is contained in | ||
57 | /// </value> | ||
58 | public UUID Folder | ||
59 | { | ||
60 | get | ||
61 | { | ||
62 | return m_folder; | ||
63 | } | ||
64 | |||
65 | set | ||
66 | { | ||
67 | m_folder = value; | ||
68 | } | ||
69 | } | ||
70 | protected UUID m_folder; | ||
71 | |||
72 | /// <value> | ||
73 | /// The creator of this item | ||
74 | /// </value> | ||
75 | public string CreatorId | ||
76 | { | ||
77 | get | ||
78 | { | ||
79 | return m_creatorId; | ||
80 | } | ||
81 | |||
82 | set | ||
83 | { | ||
84 | m_creatorId = value; | ||
85 | |||
86 | if ((m_creatorId == null) || !UUID.TryParse(m_creatorId, out m_creatorIdAsUuid)) | ||
87 | m_creatorIdAsUuid = UUID.Zero; | ||
88 | } | ||
89 | } | ||
90 | protected string m_creatorId; | ||
91 | |||
92 | /// <value> | ||
93 | /// The CreatorId expressed as a UUID. | ||
94 | /// </value> | ||
95 | public UUID CreatorIdAsUuid | ||
96 | { | ||
97 | get | ||
98 | { | ||
99 | if (UUID.Zero == m_creatorIdAsUuid) | ||
100 | { | ||
101 | UUID.TryParse(CreatorId, out m_creatorIdAsUuid); | ||
102 | } | ||
103 | |||
104 | return m_creatorIdAsUuid; | ||
105 | } | ||
106 | } | ||
107 | protected UUID m_creatorIdAsUuid = UUID.Zero; | ||
108 | |||
109 | /// <summary> | ||
110 | /// Extended creator information of the form <profile url>;<name> | ||
111 | /// </summary> | ||
112 | public string CreatorData // = <profile url>;<name> | ||
113 | { | ||
114 | get { return m_creatorData; } | ||
115 | set { m_creatorData = value; } | ||
116 | } | ||
117 | protected string m_creatorData = string.Empty; | ||
118 | |||
119 | /// <summary> | ||
120 | /// Used by the DB layer to retrieve / store the entire user identification. | ||
121 | /// The identification can either be a simple UUID or a string of the form | ||
122 | /// uuid[;profile_url[;name]] | ||
123 | /// </summary> | ||
124 | public string CreatorIdentification | ||
125 | { | ||
126 | get | ||
127 | { | ||
128 | if (!string.IsNullOrEmpty(m_creatorData)) | ||
129 | return m_creatorId + ';' + m_creatorData; | ||
130 | else | ||
131 | return m_creatorId; | ||
132 | } | ||
133 | set | ||
134 | { | ||
135 | if ((value == null) || (value != null && value == string.Empty)) | ||
136 | { | ||
137 | m_creatorData = string.Empty; | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | if (!value.Contains(";")) // plain UUID | ||
142 | { | ||
143 | m_creatorId = value; | ||
144 | } | ||
145 | else // <uuid>[;<endpoint>[;name]] | ||
146 | { | ||
147 | string name = "Unknown User"; | ||
148 | string[] parts = value.Split(';'); | ||
149 | if (parts.Length >= 1) | ||
150 | m_creatorId = parts[0]; | ||
151 | if (parts.Length >= 2) | ||
152 | m_creatorData = parts[1]; | ||
153 | if (parts.Length >= 3) | ||
154 | name = parts[2]; | ||
155 | |||
156 | m_creatorData += ';' + name; | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | |||
161 | /// <value> | ||
162 | /// The description of the inventory item (must be less than 64 characters) | ||
163 | /// </value> | ||
164 | public string Description | ||
165 | { | ||
166 | get | ||
167 | { | ||
168 | return m_description; | ||
169 | } | ||
170 | |||
171 | set | ||
172 | { | ||
173 | m_description = value; | ||
174 | } | ||
175 | } | ||
176 | protected string m_description = String.Empty; | ||
177 | |||
178 | /// <value> | ||
179 | /// | ||
180 | /// </value> | ||
181 | public uint NextPermissions | ||
182 | { | ||
183 | get | ||
184 | { | ||
185 | return m_nextPermissions; | ||
186 | } | ||
187 | |||
188 | set | ||
189 | { | ||
190 | m_nextPermissions = value; | ||
191 | } | ||
192 | } | ||
193 | protected uint m_nextPermissions; | ||
194 | |||
195 | /// <value> | ||
196 | /// A mask containing permissions for the current owner (cannot be enforced) | ||
197 | /// </value> | ||
198 | public uint CurrentPermissions | ||
199 | { | ||
200 | get | ||
201 | { | ||
202 | return m_currentPermissions; | ||
203 | } | ||
204 | |||
205 | set | ||
206 | { | ||
207 | m_currentPermissions = value; | ||
208 | } | ||
209 | } | ||
210 | protected uint m_currentPermissions; | ||
211 | |||
212 | /// <value> | ||
213 | /// | ||
214 | /// </value> | ||
215 | public uint BasePermissions | ||
216 | { | ||
217 | get | ||
218 | { | ||
219 | return m_basePermissions; | ||
220 | } | ||
221 | |||
222 | set | ||
223 | { | ||
224 | m_basePermissions = value; | ||
225 | } | ||
226 | } | ||
227 | protected uint m_basePermissions; | ||
228 | |||
229 | /// <value> | ||
230 | /// | ||
231 | /// </value> | ||
232 | public uint EveryOnePermissions | ||
233 | { | ||
234 | get | ||
235 | { | ||
236 | return m_everyonePermissions; | ||
237 | } | ||
238 | |||
239 | set | ||
240 | { | ||
241 | m_everyonePermissions = value; | ||
242 | } | ||
243 | } | ||
244 | protected uint m_everyonePermissions; | ||
245 | |||
246 | /// <value> | ||
247 | /// | ||
248 | /// </value> | ||
249 | public uint GroupPermissions | ||
250 | { | ||
251 | get | ||
252 | { | ||
253 | return m_groupPermissions; | ||
254 | } | ||
255 | |||
256 | set | ||
257 | { | ||
258 | m_groupPermissions = value; | ||
259 | } | ||
260 | } | ||
261 | protected uint m_groupPermissions; | ||
262 | |||
263 | /// <value> | ||
264 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) | ||
265 | /// </value> | ||
266 | public int AssetType | ||
267 | { | ||
268 | get | ||
269 | { | ||
270 | return m_assetType; | ||
271 | } | ||
272 | |||
273 | set | ||
274 | { | ||
275 | m_assetType = value; | ||
276 | } | ||
277 | } | ||
278 | protected int m_assetType; | ||
279 | |||
280 | /// <value> | ||
281 | /// The UUID of the associated asset on the asset server | ||
282 | /// </value> | ||
283 | public UUID AssetID | ||
284 | { | ||
285 | get | ||
286 | { | ||
287 | return m_assetID; | ||
288 | } | ||
289 | |||
290 | set | ||
291 | { | ||
292 | m_assetID = value; | ||
293 | } | ||
294 | } | ||
295 | protected UUID m_assetID; | ||
296 | |||
297 | /// <value> | ||
298 | /// | ||
299 | /// </value> | ||
300 | public UUID GroupID | ||
301 | { | ||
302 | get | ||
303 | { | ||
304 | return m_groupID; | ||
305 | } | ||
306 | |||
307 | set | ||
308 | { | ||
309 | m_groupID = value; | ||
310 | } | ||
311 | } | ||
312 | protected UUID m_groupID; | ||
313 | |||
314 | /// <value> | ||
315 | /// | ||
316 | /// </value> | ||
317 | public bool GroupOwned | ||
318 | { | ||
319 | get | ||
320 | { | ||
321 | return m_groupOwned; | ||
322 | } | ||
323 | |||
324 | set | ||
325 | { | ||
326 | m_groupOwned = value; | ||
327 | } | ||
328 | } | ||
329 | protected bool m_groupOwned; | ||
330 | |||
331 | /// <value> | ||
332 | /// | ||
333 | /// </value> | ||
334 | public int SalePrice | ||
335 | { | ||
336 | get | ||
337 | { | ||
338 | return m_salePrice; | ||
339 | } | ||
340 | |||
341 | set | ||
342 | { | ||
343 | m_salePrice = value; | ||
344 | } | ||
345 | } | ||
346 | protected int m_salePrice; | ||
347 | |||
348 | /// <value> | ||
349 | /// | ||
350 | /// </value> | ||
351 | public byte SaleType | ||
352 | { | ||
353 | get | ||
354 | { | ||
355 | return m_saleType; | ||
356 | } | ||
357 | |||
358 | set | ||
359 | { | ||
360 | m_saleType = value; | ||
361 | } | ||
362 | } | ||
363 | protected byte m_saleType; | ||
364 | |||
365 | /// <value> | ||
366 | /// | ||
367 | /// </value> | ||
368 | public uint Flags | ||
369 | { | ||
370 | get | ||
371 | { | ||
372 | return m_flags; | ||
373 | } | ||
374 | |||
375 | set | ||
376 | { | ||
377 | m_flags = value; | ||
378 | } | ||
379 | } | ||
380 | protected uint m_flags; | ||
381 | |||
382 | /// <value> | ||
383 | /// | ||
384 | /// </value> | ||
385 | public int CreationDate | ||
386 | { | ||
387 | get | ||
388 | { | ||
389 | return m_creationDate; | ||
390 | } | ||
391 | |||
392 | set | ||
393 | { | ||
394 | m_creationDate = value; | ||
395 | } | ||
396 | } | ||
397 | protected int m_creationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
398 | |||
399 | public InventoryItemBase() | ||
400 | { | ||
401 | } | ||
402 | |||
403 | public InventoryItemBase(UUID id) | ||
404 | { | ||
405 | ID = id; | ||
406 | } | ||
407 | |||
408 | public InventoryItemBase(UUID id, UUID owner) | ||
409 | { | ||
410 | ID = id; | ||
411 | Owner = owner; | ||
412 | } | ||
413 | |||
414 | public object Clone() | ||
415 | { | ||
416 | return MemberwiseClone(); | ||
417 | } | ||
418 | } | ||
419 | } | ||