diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/Null/NullGenericDataHandler.cs (renamed from OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs) | 80 |
1 files changed, 28 insertions, 52 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Data/Null/NullGenericDataHandler.cs index d7198f0..dd9d190 100644 --- a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Data/Null/NullGenericDataHandler.cs | |||
@@ -26,66 +26,42 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenMetaverse; | 29 | using System.Collections.Generic; |
30 | using log4net; | 30 | using System.Linq; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | ||
33 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Data; | ||
33 | 36 | ||
34 | namespace OpenSim.Region.Framework.Scenes.Scripting | 37 | namespace OpenSim.Data.Null |
35 | { | 38 | { |
36 | public class NullScriptHost : IScriptHost | 39 | /// <summary> |
40 | /// Not a proper generic data handler yet - probably needs to actually store the data as well instead of relying | ||
41 | /// on descendent classes | ||
42 | /// </summary> | ||
43 | public class NullGenericDataHandler | ||
37 | { | 44 | { |
38 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | protected List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities) |
39 | |||
40 | private Vector3 m_pos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30); | ||
41 | |||
42 | public string Name | ||
43 | { | ||
44 | get { return "Object"; } | ||
45 | set { } | ||
46 | } | ||
47 | |||
48 | public string SitName | ||
49 | { | 46 | { |
50 | get { return String.Empty; } | 47 | List<T> entities = inputEntities; |
51 | set { } | ||
52 | } | ||
53 | 48 | ||
54 | public string TouchName | 49 | for (int i = 0; i < fields.Length; i++) |
55 | { | 50 | { |
56 | get { return String.Empty; } | 51 | entities |
57 | set { } | 52 | = entities.Where( |
58 | } | 53 | e => |
54 | { | ||
55 | FieldInfo fi = typeof(T).GetField(fields[i]); | ||
56 | if (fi == null) | ||
57 | throw new NotImplementedException(string.Format("No field {0} for val {1}", fields[i], vals[i])); | ||
59 | 58 | ||
60 | public string Description | 59 | return fi.GetValue(e).ToString() == vals[i]; |
61 | { | 60 | } |
62 | get { return String.Empty; } | 61 | ).ToList(); |
63 | set { } | 62 | } |
64 | } | ||
65 | 63 | ||
66 | public UUID UUID | 64 | return entities; |
67 | { | ||
68 | get { return UUID.Zero; } | ||
69 | } | ||
70 | |||
71 | public UUID OwnerID | ||
72 | { | ||
73 | get { return UUID.Zero; } | ||
74 | } | ||
75 | |||
76 | public UUID CreatorID | ||
77 | { | ||
78 | get { return UUID.Zero; } | ||
79 | } | ||
80 | |||
81 | public Vector3 AbsolutePosition | ||
82 | { | ||
83 | get { return m_pos; } | ||
84 | } | ||
85 | |||
86 | public void SetText(string text, Vector3 color, double alpha) | ||
87 | { | ||
88 | m_log.Warn("Tried to SetText "+text+" on NullScriptHost"); | ||
89 | } | 65 | } |
90 | } | 66 | } |
91 | } | 67 | } \ No newline at end of file |