diff options
Some refactoring , mainly on Inventory code.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs (renamed from OpenSim/Framework/Communications/Cache/InventoryFolder.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs | 152 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs (renamed from OpenSim/Framework/Communications/Cache/UserProfileCache.cs) | 4 |
3 files changed, 37 insertions, 119 deletions
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs index fd029cd..fd029cd 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs | |||
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index 62251bc..33b4281 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs | |||
@@ -49,8 +49,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
49 | folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); | 49 | folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); |
50 | name = "OpenSim Library"; | 50 | name = "OpenSim Library"; |
51 | parentID = LLUUID.Zero; | 51 | parentID = LLUUID.Zero; |
52 | type = (short) -1; | 52 | type = (short)-1; |
53 | version = (ushort) 1; | 53 | version = (ushort)1; |
54 | 54 | ||
55 | InventoryFolderImpl folderInfo = new InventoryFolderImpl(); | 55 | InventoryFolderImpl folderInfo = new InventoryFolderImpl(); |
56 | folderInfo.agentID = libOwner; | 56 | folderInfo.agentID = libOwner; |
@@ -67,7 +67,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
67 | string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); | 67 | string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); |
68 | if (File.Exists(filePath)) | 68 | if (File.Exists(filePath)) |
69 | { | 69 | { |
70 | try | 70 | try |
71 | { | 71 | { |
72 | XmlConfigSource source = new XmlConfigSource(filePath); | 72 | XmlConfigSource source = new XmlConfigSource(filePath); |
73 | ReadItemsFromFile(source); | 73 | ReadItemsFromFile(source); |
@@ -81,143 +81,61 @@ namespace OpenSim.Framework.Communications.Cache | |||
81 | 81 | ||
82 | private void CreateLibraryItems() | 82 | private void CreateLibraryItems() |
83 | { | 83 | { |
84 | InventoryItemBase item = new InventoryItemBase(); | 84 | InventoryItemBase item = CreateItem(LLUUID.Random(), new LLUUID("00000000-0000-0000-9999-000000000002"), "Plywood", "Plywood texture", (int)AssetType.Texture, (int)InventoryType.Texture, m_textureFolder.folderID); |
85 | item.avatarID = libOwner; | ||
86 | item.creatorsID = libOwner; | ||
87 | item.inventoryID = LLUUID.Random(); | ||
88 | item.assetID = new LLUUID("00000000-0000-0000-9999-000000000002"); | ||
89 | item.inventoryDescription = "Plywood texture"; | ||
90 | item.inventoryName = "Plywood"; | ||
91 | item.assetType = (int) AssetType.Texture; | ||
92 | item.invType = (int) InventoryType.Texture; | ||
93 | item.parentFolderID = m_textureFolder.folderID; | ||
94 | item.inventoryBasePermissions = 0x7FFFFFFF; | ||
95 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | ||
96 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | ||
97 | item.inventoryNextPermissions = 0x7FFFFFFF; | ||
98 | m_textureFolder.Items.Add(item.inventoryID, item); | 85 | m_textureFolder.Items.Add(item.inventoryID, item); |
99 | 86 | ||
100 | item = new InventoryItemBase(); | 87 | item = CreateItem(LLUUID.Random(), new LLUUID("00000000-0000-0000-9999-000000000003"), "Rocks", "Rocks texture", (int)AssetType.Texture, (int)InventoryType.Texture, m_textureFolder.folderID); |
101 | item.avatarID = libOwner; | ||
102 | item.creatorsID = libOwner; | ||
103 | item.inventoryID = LLUUID.Random(); | ||
104 | item.assetID = new LLUUID("00000000-0000-0000-9999-000000000003"); | ||
105 | item.inventoryDescription = "Rocks texture"; | ||
106 | item.inventoryName = "Rocks"; | ||
107 | item.assetType = (int) AssetType.Texture; | ||
108 | item.invType = (int) InventoryType.Texture; | ||
109 | item.parentFolderID = m_textureFolder.folderID; | ||
110 | item.inventoryBasePermissions = 0x7FFFFFFF; | ||
111 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | ||
112 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | ||
113 | item.inventoryNextPermissions = 0x7FFFFFFF; | ||
114 | m_textureFolder.Items.Add(item.inventoryID, item); | 88 | m_textureFolder.Items.Add(item.inventoryID, item); |
115 | 89 | ||
116 | item = new InventoryItemBase(); | 90 | item = CreateItem(LLUUID.Random(), new LLUUID("00000000-0000-0000-9999-000000000001"), "Bricks", "Bricks texture", (int)AssetType.Texture, (int)InventoryType.Texture, m_textureFolder.folderID); |
117 | item.avatarID = libOwner; | ||
118 | item.creatorsID = libOwner; | ||
119 | item.inventoryID = LLUUID.Random(); | ||
120 | item.assetID = new LLUUID("00000000-0000-0000-9999-000000000001"); | ||
121 | item.inventoryDescription = "Bricks texture"; | ||
122 | item.inventoryName = "Bricks"; | ||
123 | item.assetType = (int) AssetType.Texture; | ||
124 | item.invType = (int) InventoryType.Texture; | ||
125 | item.parentFolderID = m_textureFolder.folderID; | ||
126 | item.inventoryBasePermissions = 0x7FFFFFFF; | ||
127 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | ||
128 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | ||
129 | item.inventoryNextPermissions = 0x7FFFFFFF; | ||
130 | m_textureFolder.Items.Add(item.inventoryID, item); | 91 | m_textureFolder.Items.Add(item.inventoryID, item); |
131 | 92 | ||
132 | item = new InventoryItemBase(); | 93 | item = CreateItem(LLUUID.Random(), new LLUUID("00000000-0000-0000-9999-000000000004"), "Granite", "Granite texture", (int)AssetType.Texture, (int)InventoryType.Texture, m_textureFolder.folderID); |
133 | item.avatarID = libOwner; | ||
134 | item.creatorsID = libOwner; | ||
135 | item.inventoryID = LLUUID.Random(); | ||
136 | item.assetID = new LLUUID("00000000-0000-0000-9999-000000000004"); | ||
137 | item.inventoryDescription = "Granite texture"; | ||
138 | item.inventoryName = "Granite"; | ||
139 | item.assetType = (int) AssetType.Texture; | ||
140 | item.invType = (int) InventoryType.Texture; | ||
141 | item.parentFolderID = m_textureFolder.folderID; | ||
142 | item.inventoryBasePermissions = 0x7FFFFFFF; | ||
143 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | ||
144 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | ||
145 | item.inventoryNextPermissions = 0x7FFFFFFF; | ||
146 | m_textureFolder.Items.Add(item.inventoryID, item); | 94 | m_textureFolder.Items.Add(item.inventoryID, item); |
147 | 95 | ||
148 | item = new InventoryItemBase(); | 96 | item = CreateItem(LLUUID.Random(), new LLUUID("00000000-0000-0000-9999-000000000005"), "Hardwood", "Hardwood texture", (int)AssetType.Texture, (int)InventoryType.Texture, m_textureFolder.folderID); |
149 | item.avatarID = libOwner; | ||
150 | item.creatorsID = libOwner; | ||
151 | item.inventoryID = LLUUID.Random(); | ||
152 | item.assetID = new LLUUID("00000000-0000-0000-9999-000000000005"); | ||
153 | item.inventoryDescription = "Hardwood texture"; | ||
154 | item.inventoryName = "Hardwood"; | ||
155 | item.assetType = (int) AssetType.Texture; | ||
156 | item.invType = (int) InventoryType.Texture; | ||
157 | item.parentFolderID = m_textureFolder.folderID; | ||
158 | item.inventoryBasePermissions = 0x7FFFFFFF; | ||
159 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | ||
160 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | ||
161 | item.inventoryNextPermissions = 0x7FFFFFFF; | ||
162 | m_textureFolder.Items.Add(item.inventoryID, item); | 97 | m_textureFolder.Items.Add(item.inventoryID, item); |
163 | 98 | ||
164 | item = new InventoryItemBase(); | 99 | item = CreateItem(new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"), new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"), "Default Shape", "Default Shape", (int)AssetType.Bodypart, (int)InventoryType.Wearable, folderID); |
165 | item.avatarID = libOwner; | ||
166 | item.creatorsID = libOwner; | ||
167 | item.inventoryID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"); | ||
168 | item.assetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
169 | item.inventoryDescription = "Default Shape"; | ||
170 | item.inventoryName = "Default Shape"; | ||
171 | item.assetType = (int) AssetType.Bodypart; | ||
172 | item.invType = (int) InventoryType.Wearable; | ||
173 | item.parentFolderID = folderID; | ||
174 | item.inventoryCurrentPermissions = 0; | 100 | item.inventoryCurrentPermissions = 0; |
175 | item.inventoryNextPermissions = 0; | 101 | item.inventoryNextPermissions = 0; |
176 | Items.Add(item.inventoryID, item); | 102 | Items.Add(item.inventoryID, item); |
177 | 103 | ||
178 | item = new InventoryItemBase(); | 104 | item = CreateItem(new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"), new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"), "Default Skin", "Default Skin", (int)AssetType.Bodypart, (int)InventoryType.Wearable, folderID); |
179 | item.avatarID = libOwner; | ||
180 | item.creatorsID = libOwner; | ||
181 | item.inventoryID = new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"); | ||
182 | item.assetID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); | ||
183 | item.inventoryDescription = "Default Skin"; | ||
184 | item.inventoryName = "Default Skin"; | ||
185 | item.assetType = (int) AssetType.Bodypart; | ||
186 | item.invType = (int) InventoryType.Wearable; | ||
187 | item.parentFolderID = folderID; | ||
188 | item.inventoryCurrentPermissions = 0; | 105 | item.inventoryCurrentPermissions = 0; |
189 | item.inventoryNextPermissions = 0; | 106 | item.inventoryNextPermissions = 0; |
190 | Items.Add(item.inventoryID, item); | 107 | Items.Add(item.inventoryID, item); |
191 | 108 | ||
192 | item = new InventoryItemBase(); | 109 | item = CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"), new LLUUID("00000000-38f9-1111-024e-222222111110"), "Default Shirt", "Default Shirt", (int)AssetType.Clothing, (int)InventoryType.Wearable, folderID); |
193 | item.avatarID = libOwner; | ||
194 | item.creatorsID = libOwner; | ||
195 | item.inventoryID = new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"); | ||
196 | item.assetID = new LLUUID("00000000-38f9-1111-024e-222222111110"); | ||
197 | item.inventoryDescription = "Default Shirt"; | ||
198 | item.inventoryName = "Default Shirt"; | ||
199 | item.assetType = (int) AssetType.Clothing; | ||
200 | item.invType = (int) InventoryType.Wearable; | ||
201 | item.parentFolderID = folderID; | ||
202 | item.inventoryCurrentPermissions = 0; | 110 | item.inventoryCurrentPermissions = 0; |
203 | item.inventoryNextPermissions = 0; | 111 | item.inventoryNextPermissions = 0; |
204 | Items.Add(item.inventoryID, item); | 112 | Items.Add(item.inventoryID, item); |
205 | 113 | ||
206 | item = new InventoryItemBase(); | 114 | item = CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"), new LLUUID("00000000-38f9-1111-024e-222222111120"), "Default Pants", "Default Pants", (int)AssetType.Clothing, (int)InventoryType.Wearable, folderID); |
207 | item.avatarID = libOwner; | ||
208 | item.creatorsID = libOwner; | ||
209 | item.inventoryID = new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"); | ||
210 | item.assetID = new LLUUID("00000000-38f9-1111-024e-222222111120"); | ||
211 | item.inventoryDescription = "Default Pants"; | ||
212 | item.inventoryName = "Default Pants"; | ||
213 | item.assetType = (int) AssetType.Clothing; | ||
214 | item.invType = (int) InventoryType.Wearable; | ||
215 | item.parentFolderID = folderID; | ||
216 | item.inventoryCurrentPermissions = 0; | 115 | item.inventoryCurrentPermissions = 0; |
217 | item.inventoryNextPermissions = 0; | 116 | item.inventoryNextPermissions = 0; |
218 | Items.Add(item.inventoryID, item); | 117 | Items.Add(item.inventoryID, item); |
219 | } | 118 | } |
220 | 119 | ||
120 | private InventoryItemBase CreateItem(LLUUID inventoryID, LLUUID assetID, string name, string description, int assetType, int invType, LLUUID parentFolderID) | ||
121 | { | ||
122 | InventoryItemBase item = new InventoryItemBase(); | ||
123 | item.avatarID = libOwner; | ||
124 | item.creatorsID = libOwner; | ||
125 | item.inventoryID = LLUUID.Random(); | ||
126 | item.assetID = assetID; | ||
127 | item.inventoryDescription = description; | ||
128 | item.inventoryName = name; | ||
129 | item.assetType = assetType; | ||
130 | item.invType = invType; | ||
131 | item.parentFolderID = parentFolderID; | ||
132 | item.inventoryBasePermissions = 0x7FFFFFFF; | ||
133 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | ||
134 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | ||
135 | item.inventoryNextPermissions = 0x7FFFFFFF; | ||
136 | return item; | ||
137 | } | ||
138 | |||
221 | private void ReadItemsFromFile(IConfigSource source) | 139 | private void ReadItemsFromFile(IConfigSource source) |
222 | { | 140 | { |
223 | for (int i = 0; i < source.Configs.Count; i++) | 141 | for (int i = 0; i < source.Configs.Count; i++) |
@@ -232,10 +150,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
232 | item.inventoryName = source.Configs[i].GetString("name", ""); | 150 | item.inventoryName = source.Configs[i].GetString("name", ""); |
233 | item.assetType = source.Configs[i].GetInt("assetType", 0); | 151 | item.assetType = source.Configs[i].GetInt("assetType", 0); |
234 | item.invType = source.Configs[i].GetInt("inventoryType", 0); | 152 | item.invType = source.Configs[i].GetInt("inventoryType", 0); |
235 | item.inventoryCurrentPermissions = (uint) source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); | 153 | item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); |
236 | item.inventoryNextPermissions = (uint) source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); | 154 | item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); |
237 | item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); | 155 | item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); |
238 | item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); | 156 | item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); |
239 | if (item.assetType == 0) | 157 | if (item.assetType == 0) |
240 | { | 158 | { |
241 | item.parentFolderID = m_textureFolder.folderID; | 159 | item.parentFolderID = m_textureFolder.folderID; |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 3c8ab51..b24d763 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -30,7 +30,7 @@ using libsecondlife; | |||
30 | 30 | ||
31 | namespace OpenSim.Framework.Communications.Cache | 31 | namespace OpenSim.Framework.Communications.Cache |
32 | { | 32 | { |
33 | public class UserProfileCache | 33 | public class UserProfileCacheService |
34 | { | 34 | { |
35 | // Fields | 35 | // Fields |
36 | private readonly CommunicationsManager m_parent; | 36 | private readonly CommunicationsManager m_parent; |
@@ -39,7 +39,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
39 | public LibraryRootFolder libraryRoot = new LibraryRootFolder(); | 39 | public LibraryRootFolder libraryRoot = new LibraryRootFolder(); |
40 | 40 | ||
41 | // Methods | 41 | // Methods |
42 | public UserProfileCache(CommunicationsManager parent) | 42 | public UserProfileCacheService(CommunicationsManager parent) |
43 | { | 43 | { |
44 | m_parent = parent; | 44 | m_parent = parent; |
45 | } | 45 | } |