aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorlbsa712007-10-15 04:27:52 +0000
committerlbsa712007-10-15 04:27:52 +0000
commit8b01821dbacf1c54fd1d729d4fba6558564c1904 (patch)
tree2098f22c297ec97d8b47e18f47e603d4a0475f84 /OpenSim/Framework
parentrecompiled libode with g++ 3.3 -- should fix problems loading on some distros... (diff)
downloadopensim-SC_OLD-8b01821dbacf1c54fd1d729d4fba6558564c1904.zip
opensim-SC_OLD-8b01821dbacf1c54fd1d729d4fba6558564c1904.tar.gz
opensim-SC_OLD-8b01821dbacf1c54fd1d729d4fba6558564c1904.tar.bz2
opensim-SC_OLD-8b01821dbacf1c54fd1d729d4fba6558564c1904.tar.xz
* normalized line endings
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs610
1 files changed, 305 insertions, 305 deletions
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
index 2a38307..082a240 100644
--- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -1,310 +1,310 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Threading; 30using System.Threading;
31using System.Reflection; 31using System.Reflection;
32using libsecondlife; 32using libsecondlife;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Framework.Utilities; 37using OpenSim.Framework.Utilities;
38 38
39namespace OpenSim.Framework.Communications.Caches 39namespace OpenSim.Framework.Communications.Caches
40{ 40{
41 41
42 public class SQLAssetServer : IAssetServer 42 public class SQLAssetServer : IAssetServer
43 { 43 {
44 private IAssetReceiver _receiver; 44 private IAssetReceiver _receiver;
45 private BlockingQueue<ARequest> _assetRequests; 45 private BlockingQueue<ARequest> _assetRequests;
46 private Thread _localAssetServerThread; 46 private Thread _localAssetServerThread;
47 protected IAssetProvider m_assetProviderPlugin; 47 protected IAssetProvider m_assetProviderPlugin;
48 private object syncLock = new object(); 48 private object syncLock = new object();
49 49
50 50
51 public SQLAssetServer(string pluginName) 51 public SQLAssetServer(string pluginName)
52 { 52 {
53 _assetRequests = new BlockingQueue<ARequest>(); 53 _assetRequests = new BlockingQueue<ARequest>();
54 AddPlugin(pluginName); 54 AddPlugin(pluginName);
55 55
56 SetUpAssetDatabase(); 56 SetUpAssetDatabase();
57 57
58 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); 58 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
59 this._localAssetServerThread.IsBackground = true; 59 this._localAssetServerThread.IsBackground = true;
60 this._localAssetServerThread.Start(); 60 this._localAssetServerThread.Start();
61 61
62 } 62 }
63 63
64 public void AddPlugin(string FileName) 64 public void AddPlugin(string FileName)
65 { 65 {
66 MainLog.Instance.Verbose("SQLAssetServer", "AssetStorage: Attempting to load " + FileName); 66 MainLog.Instance.Verbose("SQLAssetServer", "AssetStorage: Attempting to load " + FileName);
67 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 67 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
68 68
69 foreach (Type pluginType in pluginAssembly.GetTypes()) 69 foreach (Type pluginType in pluginAssembly.GetTypes())
70 { 70 {
71 if (!pluginType.IsAbstract) 71 if (!pluginType.IsAbstract)
72 { 72 {
73 Type typeInterface = pluginType.GetInterface("IAssetProvider", true); 73 Type typeInterface = pluginType.GetInterface("IAssetProvider", true);
74 74
75 if (typeInterface != null) 75 if (typeInterface != null)
76 { 76 {
77 IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 77 IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
78 m_assetProviderPlugin = plug; 78 m_assetProviderPlugin = plug;
79 m_assetProviderPlugin.Initialise(); 79 m_assetProviderPlugin.Initialise();
80 80
81 MainLog.Instance.Verbose("AssetStorage: Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version); 81 MainLog.Instance.Verbose("AssetStorage: Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version);
82 } 82 }
83 83
84 typeInterface = null; 84 typeInterface = null;
85 } 85 }
86 } 86 }
87 87
88 pluginAssembly = null; 88 pluginAssembly = null;
89 } 89 }
90 90
91 public void SetReceiver(IAssetReceiver receiver) 91 public void SetReceiver(IAssetReceiver receiver)
92 { 92 {
93 this._receiver = receiver; 93 this._receiver = receiver;
94 } 94 }
95 95
96 public void FetchAsset(LLUUID assetID, bool isTexture) 96 public void FetchAsset(LLUUID assetID, bool isTexture)
97 { 97 {
98 ARequest req = new ARequest(); 98 ARequest req = new ARequest();
99 req.AssetID = assetID; 99 req.AssetID = assetID;
100 req.IsTexture = isTexture; 100 req.IsTexture = isTexture;
101 this._assetRequests.Enqueue(req); 101 this._assetRequests.Enqueue(req);
102 } 102 }
103 103
104 public void UpdateAsset(AssetBase asset) 104 public void UpdateAsset(AssetBase asset)
105 { 105 {
106 lock (syncLock) 106 lock (syncLock)
107 { 107 {
108 m_assetProviderPlugin.UpdateAsset(asset); 108 m_assetProviderPlugin.UpdateAsset(asset);
109 m_assetProviderPlugin.CommitAssets(); 109 m_assetProviderPlugin.CommitAssets();
110 } 110 }
111 } 111 }
112 112
113 public void CreateAsset(AssetBase asset) 113 public void CreateAsset(AssetBase asset)
114 { 114 {
115 lock (syncLock) 115 lock (syncLock)
116 { 116 {
117 m_assetProviderPlugin.CreateAsset(asset); 117 m_assetProviderPlugin.CreateAsset(asset);
118 m_assetProviderPlugin.CommitAssets(); 118 m_assetProviderPlugin.CommitAssets();
119 } 119 }
120 } 120 }
121 121
122 public void SetServerInfo(string ServerUrl, string ServerKey) 122 public void SetServerInfo(string ServerUrl, string ServerKey)
123 { 123 {
124 124
125 } 125 }
126 public void Close() 126 public void Close()
127 { 127 {
128 m_assetProviderPlugin.CommitAssets(); 128 m_assetProviderPlugin.CommitAssets();
129 } 129 }
130 130
131 private void RunRequests() 131 private void RunRequests()
132 { 132 {
133 133
134 while (true) 134 while (true)
135 { 135 {
136 ARequest req = this._assetRequests.Dequeue(); 136 ARequest req = this._assetRequests.Dequeue();
137 137
138 MainLog.Instance.Verbose("Requesting asset: " + req.AssetID); 138 MainLog.Instance.Verbose("Requesting asset: " + req.AssetID);
139 139
140 AssetBase asset = null; 140 AssetBase asset = null;
141 lock (syncLock) 141 lock (syncLock)
142 { 142 {
143 asset = m_assetProviderPlugin.FetchAsset(req.AssetID); 143 asset = m_assetProviderPlugin.FetchAsset(req.AssetID);
144 } 144 }
145 if (asset != null) 145 if (asset != null)
146 { 146 {
147 _receiver.AssetReceived(asset, req.IsTexture); 147 _receiver.AssetReceived(asset, req.IsTexture);
148 } 148 }
149 else 149 else
150 { 150 {
151 _receiver.AssetNotFound(req.AssetID); 151 _receiver.AssetNotFound(req.AssetID);
152 } 152 }
153 153
154 } 154 }
155 155
156 } 156 }
157 157
158 private void SetUpAssetDatabase() 158 private void SetUpAssetDatabase()
159 { 159 {
160 MainLog.Instance.Verbose("Setting up asset database"); 160 MainLog.Instance.Verbose("Setting up asset database");
161 161
162 AssetBase Image = new AssetBase(); 162 AssetBase Image = new AssetBase();
163 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); 163 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
164 Image.Name = "Bricks"; 164 Image.Name = "Bricks";
165 this.LoadAsset(Image, true, "bricks.jp2"); 165 this.LoadAsset(Image, true, "bricks.jp2");
166 m_assetProviderPlugin.CreateAsset(Image); 166 m_assetProviderPlugin.CreateAsset(Image);
167 167
168 Image = new AssetBase(); 168 Image = new AssetBase();
169 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); 169 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
170 Image.Name = "Plywood"; 170 Image.Name = "Plywood";
171 this.LoadAsset(Image, true, "plywood.jp2"); 171 this.LoadAsset(Image, true, "plywood.jp2");
172 m_assetProviderPlugin.CreateAsset(Image); 172 m_assetProviderPlugin.CreateAsset(Image);
173 173
174 Image = new AssetBase(); 174 Image = new AssetBase();
175 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); 175 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
176 Image.Name = "Rocks"; 176 Image.Name = "Rocks";
177 this.LoadAsset(Image, true, "rocks.jp2"); 177 this.LoadAsset(Image, true, "rocks.jp2");
178 m_assetProviderPlugin.CreateAsset(Image); 178 m_assetProviderPlugin.CreateAsset(Image);
179 179
180 Image = new AssetBase(); 180 Image = new AssetBase();
181 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); 181 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
182 Image.Name = "Granite"; 182 Image.Name = "Granite";
183 this.LoadAsset(Image, true, "granite.jp2"); 183 this.LoadAsset(Image, true, "granite.jp2");
184 m_assetProviderPlugin.CreateAsset(Image); 184 m_assetProviderPlugin.CreateAsset(Image);
185 185
186 Image = new AssetBase(); 186 Image = new AssetBase();
187 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); 187 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
188 Image.Name = "Hardwood"; 188 Image.Name = "Hardwood";
189 this.LoadAsset(Image, true, "hardwood.jp2"); 189 this.LoadAsset(Image, true, "hardwood.jp2");
190 m_assetProviderPlugin.CreateAsset(Image); 190 m_assetProviderPlugin.CreateAsset(Image);
191 191
192 Image = new AssetBase(); 192 Image = new AssetBase();
193 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); 193 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
194 Image.Name = "Prim Base Texture"; 194 Image.Name = "Prim Base Texture";
195 this.LoadAsset(Image, true, "plywood.jp2"); 195 this.LoadAsset(Image, true, "plywood.jp2");
196 m_assetProviderPlugin.CreateAsset(Image); 196 m_assetProviderPlugin.CreateAsset(Image);
197 197
198 Image = new AssetBase(); 198 Image = new AssetBase();
199 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); 199 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006");
200 Image.Name = "Map Base Texture"; 200 Image.Name = "Map Base Texture";
201 this.LoadAsset(Image, true, "map_base.jp2"); 201 this.LoadAsset(Image, true, "map_base.jp2");
202 m_assetProviderPlugin.CreateAsset(Image); 202 m_assetProviderPlugin.CreateAsset(Image);
203 203
204 Image = new AssetBase(); 204 Image = new AssetBase();
205 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); 205 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007");
206 Image.Name = "Map Texture"; 206 Image.Name = "Map Texture";
207 this.LoadAsset(Image, true, "map1.jp2"); 207 this.LoadAsset(Image, true, "map1.jp2");
208 m_assetProviderPlugin.CreateAsset(Image); 208 m_assetProviderPlugin.CreateAsset(Image);
209 209
210 Image = new AssetBase(); 210 Image = new AssetBase();
211 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); 211 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010");
212 Image.Name = "Female Body Texture"; 212 Image.Name = "Female Body Texture";
213 this.LoadAsset(Image, true, "femalebody.jp2"); 213 this.LoadAsset(Image, true, "femalebody.jp2");
214 m_assetProviderPlugin.CreateAsset(Image); 214 m_assetProviderPlugin.CreateAsset(Image);
215 215
216 Image = new AssetBase(); 216 Image = new AssetBase();
217 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); 217 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011");
218 Image.Name = "Female Bottom Texture"; 218 Image.Name = "Female Bottom Texture";
219 this.LoadAsset(Image, true, "femalebottom.jp2"); 219 this.LoadAsset(Image, true, "femalebottom.jp2");
220 m_assetProviderPlugin.CreateAsset(Image); 220 m_assetProviderPlugin.CreateAsset(Image);
221 221
222 Image = new AssetBase(); 222 Image = new AssetBase();
223 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); 223 Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012");
224 Image.Name = "Female Face Texture"; 224 Image.Name = "Female Face Texture";
225 this.LoadAsset(Image, true, "femaleface.jp2"); 225 this.LoadAsset(Image, true, "femaleface.jp2");
226 m_assetProviderPlugin.CreateAsset(Image); 226 m_assetProviderPlugin.CreateAsset(Image);
227 227
228 Image = new AssetBase(); 228 Image = new AssetBase();
229 Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); 229 Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb");
230 Image.Name = "Skin"; 230 Image.Name = "Skin";
231 Image.Type = 13; 231 Image.Type = 13;
232 Image.InvType = 13; 232 Image.InvType = 13;
233 this.LoadAsset(Image, false, "base_skin.dat"); 233 this.LoadAsset(Image, false, "base_skin.dat");
234 m_assetProviderPlugin.CreateAsset(Image); 234 m_assetProviderPlugin.CreateAsset(Image);
235 235
236 Image = new AssetBase(); 236 Image = new AssetBase();
237 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); 237 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
238 Image.Name = "Shape"; 238 Image.Name = "Shape";
239 Image.Type = 13; 239 Image.Type = 13;
240 Image.InvType = 13; 240 Image.InvType = 13;
241 this.LoadAsset(Image, false, "base_shape.dat"); 241 this.LoadAsset(Image, false, "base_shape.dat");
242 m_assetProviderPlugin.CreateAsset(Image); 242 m_assetProviderPlugin.CreateAsset(Image);
243 243
244 Image = new AssetBase(); 244 Image = new AssetBase();
245 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); 245 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110");
246 Image.Name = "Shirt"; 246 Image.Name = "Shirt";
247 Image.Type = 5; 247 Image.Type = 5;
248 Image.InvType = 18; 248 Image.InvType = 18;
249 this.LoadAsset(Image, false, "newshirt.dat"); 249 this.LoadAsset(Image, false, "newshirt.dat");
250 m_assetProviderPlugin.CreateAsset(Image); 250 m_assetProviderPlugin.CreateAsset(Image);
251 251
252 Image = new AssetBase(); 252 Image = new AssetBase();
253 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); 253 Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120");
254 Image.Name = "Shirt"; 254 Image.Name = "Shirt";
255 Image.Type = 5; 255 Image.Type = 5;
256 Image.InvType = 18; 256 Image.InvType = 18;
257 this.LoadAsset(Image, false, "newpants.dat"); 257 this.LoadAsset(Image, false, "newpants.dat");
258 m_assetProviderPlugin.CreateAsset(Image); 258 m_assetProviderPlugin.CreateAsset(Image);
259 259
260 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); 260 string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml");
261 if (File.Exists(filePath)) 261 if (File.Exists(filePath))
262 { 262 {
263 XmlConfigSource source = new XmlConfigSource(filePath); 263 XmlConfigSource source = new XmlConfigSource(filePath);
264 ReadAssetDetails(source); 264 ReadAssetDetails(source);
265 } 265 }
266 266
267 m_assetProviderPlugin.CommitAssets(); 267 m_assetProviderPlugin.CommitAssets();
268 } 268 }
269 269
270 protected void ReadAssetDetails(IConfigSource source) 270 protected void ReadAssetDetails(IConfigSource source)
271 { 271 {
272 AssetBase newAsset = null; 272 AssetBase newAsset = null;
273 for (int i = 0; i < source.Configs.Count; i++) 273 for (int i = 0; i < source.Configs.Count; i++)
274 { 274 {
275 newAsset = new AssetBase(); 275 newAsset = new AssetBase();
276 newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); 276 newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
277 newAsset.Name = source.Configs[i].GetString("name", ""); 277 newAsset.Name = source.Configs[i].GetString("name", "");
278 newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0); 278 newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0);
279 newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); 279 newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0);
280 string fileName = source.Configs[i].GetString("fileName", ""); 280 string fileName = source.Configs[i].GetString("fileName", "");
281 if (fileName != "") 281 if (fileName != "")
282 { 282 {
283 MainLog.Instance.Verbose("Creating new asset: " + newAsset.Name); 283 MainLog.Instance.Verbose("Creating new asset: " + newAsset.Name);
284 this.LoadAsset(newAsset, false, fileName); 284 this.LoadAsset(newAsset, false, fileName);
285 m_assetProviderPlugin.CreateAsset(newAsset); 285 m_assetProviderPlugin.CreateAsset(newAsset);
286 } 286 }
287 } 287 }
288 } 288 }
289 289
290 private void LoadAsset(AssetBase info, bool image, string filename) 290 private void LoadAsset(AssetBase info, bool image, string filename)
291 { 291 {
292 //should request Asset from storage manager 292 //should request Asset from storage manager
293 //but for now read from file 293 //but for now read from file
294 294
295 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; 295 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
296 string fileName = Path.Combine(dataPath, filename); 296 string fileName = Path.Combine(dataPath, filename);
297 FileInfo fInfo = new FileInfo(fileName); 297 FileInfo fInfo = new FileInfo(fileName);
298 long numBytes = fInfo.Length; 298 long numBytes = fInfo.Length;
299 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); 299 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
300 byte[] idata = new byte[numBytes]; 300 byte[] idata = new byte[numBytes];
301 BinaryReader br = new BinaryReader(fStream); 301 BinaryReader br = new BinaryReader(fStream);
302 idata = br.ReadBytes((int)numBytes); 302 idata = br.ReadBytes((int)numBytes);
303 br.Close(); 303 br.Close();
304 fStream.Close(); 304 fStream.Close();
305 info.Data = idata; 305 info.Data = idata;
306 //info.loaded=true; 306 //info.loaded=true;
307 } 307 }
308 } 308 }
309 309
310} 310}