diff options
author | MW | 2007-02-04 11:36:35 +0000 |
---|---|---|
committer | MW | 2007-02-04 11:36:35 +0000 |
commit | 8c80d98252f376a815e522c705a3c576dfc16f75 (patch) | |
tree | 89e779435d3e9ea2a58b814d81a64e44e4067cc6 /AssetManagement.cs | |
parent | Basic Inventory support and clean up (diff) | |
download | opensim-SC-8c80d98252f376a815e522c705a3c576dfc16f75.zip opensim-SC-8c80d98252f376a815e522c705a3c576dfc16f75.tar.gz opensim-SC-8c80d98252f376a815e522c705a3c576dfc16f75.tar.bz2 opensim-SC-8c80d98252f376a815e522c705a3c576dfc16f75.tar.xz |
Clean up
Diffstat (limited to 'AssetManagement.cs')
-rw-r--r-- | AssetManagement.cs | 299 |
1 files changed, 150 insertions, 149 deletions
diff --git a/AssetManagement.cs b/AssetManagement.cs index a43a969..07b2b57 100644 --- a/AssetManagement.cs +++ b/AssetManagement.cs | |||
@@ -44,22 +44,23 @@ namespace OpenSim | |||
44 | public Dictionary<libsecondlife.LLUUID,AssetInfo> Assets; | 44 | public Dictionary<libsecondlife.LLUUID,AssetInfo> Assets; |
45 | public Dictionary<libsecondlife.LLUUID,TextureImage> Textures; | 45 | public Dictionary<libsecondlife.LLUUID,TextureImage> Textures; |
46 | 46 | ||
47 | public ArrayList AssetRequests=new ArrayList(); //should change to a generic | 47 | public ArrayList AssetRequests = new ArrayList(); //should change to a generic |
48 | public ArrayList TextureRequests=new ArrayList(); | 48 | public ArrayList TextureRequests = new ArrayList(); |
49 | // public ArrayList uploads=new ArrayList(); | 49 | //public ArrayList uploads=new ArrayList(); |
50 | private Server server; | 50 | private Server _server; |
51 | public InventoryManager InventoryManager; | 51 | private InventoryManager _inventoryManager; |
52 | private System.Text.Encoding enc = System.Text.Encoding.ASCII; | 52 | private System.Text.Encoding _enc = System.Text.Encoding.ASCII; |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// | 55 | /// |
56 | /// </summary> | 56 | /// </summary> |
57 | /// <param name="server"></param> | 57 | /// <param name="_server"></param> |
58 | public AssetManagement(Server server) | 58 | public AssetManagement(Server server, InventoryManager inventoryManager) |
59 | { | 59 | { |
60 | this.server=server; | 60 | this._server = server; |
61 | Textures=new Dictionary<libsecondlife.LLUUID,TextureImage> (); | 61 | this._inventoryManager = inventoryManager; |
62 | Assets=new Dictionary<libsecondlife.LLUUID,AssetInfo> (); | 62 | Textures = new Dictionary<libsecondlife.LLUUID,TextureImage> (); |
63 | Assets = new Dictionary<libsecondlife.LLUUID,AssetInfo> (); | ||
63 | this.initialise(); | 64 | this.initialise(); |
64 | } | 65 | } |
65 | 66 | ||
@@ -69,38 +70,38 @@ namespace OpenSim | |||
69 | private void initialise() | 70 | private void initialise() |
70 | { | 71 | { |
71 | //Shape and skin base assets | 72 | //Shape and skin base assets |
72 | AssetInfo Asset=new AssetInfo(); | 73 | AssetInfo Asset = new AssetInfo(); |
73 | Asset.filename="base_shape.dat"; | 74 | Asset.filename = "base_shape.dat"; |
74 | Asset.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 75 | Asset.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
75 | this.LoadAsset(Asset, false); | 76 | this.LoadAsset(Asset, false); |
76 | this.Assets.Add(Asset.Full_ID, Asset); | 77 | this.Assets.Add(Asset.FullID, Asset); |
77 | 78 | ||
78 | Asset=new AssetInfo(); | 79 | Asset = new AssetInfo(); |
79 | Asset.filename="base_skin.dat"; | 80 | Asset.filename = "base_skin.dat"; |
80 | Asset.Full_ID=new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49"); | 81 | Asset.FullID = new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49"); |
81 | this.LoadAsset(Asset, false); | 82 | this.LoadAsset(Asset, false); |
82 | this.Assets.Add(Asset.Full_ID, Asset); | 83 | this.Assets.Add(Asset.FullID, Asset); |
83 | 84 | ||
84 | //our test images | 85 | //our test images |
85 | //Change these filenames to images you want to use. | 86 | //Change these filenames to images you want to use. |
86 | TextureImage Image=new TextureImage(); | 87 | TextureImage Image = new TextureImage(); |
87 | Image.filename="testpic2.jp2"; | 88 | Image.filename = "testpic2.jp2"; |
88 | Image.Full_ID=new LLUUID("00000000-0000-0000-5005-000000000005"); | 89 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); |
89 | Image.Name="test Texture"; | 90 | Image.Name = "test Texture"; |
90 | this.LoadAsset(Image, true); | 91 | this.LoadAsset(Image, true); |
91 | this.Textures.Add(Image.Full_ID, Image); | 92 | this.Textures.Add(Image.FullID, Image); |
92 | 93 | ||
93 | Image=new TextureImage(); | 94 | Image = new TextureImage(); |
94 | Image.filename="map_base.jp2"; | 95 | Image.filename = "map_base.jp2"; |
95 | Image.Full_ID=new LLUUID("00000000-0000-0000-7007-000000000006"); | 96 | Image.FullID = new LLUUID("00000000-0000-0000-7007-000000000006"); |
96 | this.LoadAsset(Image, true); | 97 | this.LoadAsset(Image, true); |
97 | this.Textures.Add(Image.Full_ID, Image); | 98 | this.Textures.Add(Image.FullID, Image); |
98 | 99 | ||
99 | Image=new TextureImage(); | 100 | Image = new TextureImage(); |
100 | Image.filename="map1.jp2"; | 101 | Image.filename = "map1.jp2"; |
101 | Image.Full_ID=new LLUUID("00000000-0000-0000-7009-000000000008"); | 102 | Image.FullID = new LLUUID("00000000-0000-0000-7009-000000000008"); |
102 | this.LoadAsset(Image, true); | 103 | this.LoadAsset(Image, true); |
103 | this.Textures.Add(Image.Full_ID, Image); | 104 | this.Textures.Add(Image.FullID, Image); |
104 | } | 105 | } |
105 | 106 | ||
106 | /// <summary> | 107 | /// <summary> |
@@ -111,101 +112,101 @@ namespace OpenSim | |||
111 | /// <param name="TransferRequest"></param> | 112 | /// <param name="TransferRequest"></param> |
112 | #region AssetRegion | 113 | #region AssetRegion |
113 | 114 | ||
114 | public void AddAssetRequest(User_Agent_info UserInfo, LLUUID AssetID, TransferRequestPacket TransferRequest) | 115 | public void AddAssetRequest(UserAgentInfo userInfo, LLUUID assetID, TransferRequestPacket transferRequest) |
115 | { | 116 | { |
116 | 117 | ||
117 | if(!this.Assets.ContainsKey(AssetID)) | 118 | if(!this.Assets.ContainsKey(assetID)) |
118 | { | 119 | { |
119 | //not found asset | 120 | //not found asset |
120 | return; | 121 | return; |
121 | } | 122 | } |
122 | AssetInfo info=this.Assets[AssetID]; | 123 | AssetInfo info = this.Assets[assetID]; |
123 | //for now as it will be only skin or shape request just send back the asset | 124 | //for now as it will be only skin or shape request just send back the asset |
124 | TransferInfoPacket Transfer=new TransferInfoPacket(); | 125 | TransferInfoPacket Transfer = new TransferInfoPacket(); |
125 | Transfer.TransferInfo.ChannelType=2; | 126 | Transfer.TransferInfo.ChannelType = 2; |
126 | Transfer.TransferInfo.Status=0; | 127 | Transfer.TransferInfo.Status = 0; |
127 | Transfer.TransferInfo.TargetType=0; | 128 | Transfer.TransferInfo.TargetType = 0; |
128 | Transfer.TransferInfo.Params=TransferRequest.TransferInfo.Params; | 129 | Transfer.TransferInfo.Params = transferRequest.TransferInfo.Params; |
129 | Transfer.TransferInfo.Size=info.data.Length; | 130 | Transfer.TransferInfo.Size = info.data.Length; |
130 | Transfer.TransferInfo.TransferID=TransferRequest.TransferInfo.TransferID; | 131 | Transfer.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; |
131 | 132 | ||
132 | server.SendPacket(Transfer, true, UserInfo); | 133 | _server.SendPacket(Transfer, true, userInfo); |
133 | 134 | ||
134 | TransferPacketPacket TransferPacket=new TransferPacketPacket(); | 135 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); |
135 | TransferPacket.TransferData.Packet=0; | 136 | TransferPacket.TransferData.Packet = 0; |
136 | TransferPacket.TransferData.ChannelType=2; | 137 | TransferPacket.TransferData.ChannelType = 2; |
137 | TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID; | 138 | TransferPacket.TransferData.TransferID=transferRequest.TransferInfo.TransferID; |
138 | if(info.data.Length>1000) //but needs to be less than 2000 at the moment | 139 | if(info.data.Length>1000) //but needs to be less than 2000 at the moment |
139 | { | 140 | { |
140 | byte[] chunk=new byte[1000]; | 141 | byte[] chunk = new byte[1000]; |
141 | Array.Copy(info.data,chunk,1000); | 142 | Array.Copy(info.data,chunk,1000); |
142 | TransferPacket.TransferData.Data=chunk; | 143 | TransferPacket.TransferData.Data = chunk; |
143 | TransferPacket.TransferData.Status=0; | 144 | TransferPacket.TransferData.Status = 0; |
144 | server.SendPacket(TransferPacket,true,UserInfo); | 145 | _server.SendPacket(TransferPacket,true,userInfo); |
145 | 146 | ||
146 | TransferPacket=new TransferPacketPacket(); | 147 | TransferPacket = new TransferPacketPacket(); |
147 | TransferPacket.TransferData.Packet=1; | 148 | TransferPacket.TransferData.Packet = 1; |
148 | TransferPacket.TransferData.ChannelType=2; | 149 | TransferPacket.TransferData.ChannelType = 2; |
149 | TransferPacket.TransferData.TransferID=TransferRequest.TransferInfo.TransferID; | 150 | TransferPacket.TransferData.TransferID = transferRequest.TransferInfo.TransferID; |
150 | byte[] chunk1=new byte[(info.data.Length-1000)]; | 151 | byte[] chunk1 = new byte[(info.data.Length-1000)]; |
151 | Array.Copy(info.data, 1000, chunk1, 0, chunk1.Length); | 152 | Array.Copy(info.data, 1000, chunk1, 0, chunk1.Length); |
152 | TransferPacket.TransferData.Data=chunk1; | 153 | TransferPacket.TransferData.Data = chunk1; |
153 | TransferPacket.TransferData.Status=1; | 154 | TransferPacket.TransferData.Status = 1; |
154 | server.SendPacket(TransferPacket, true, UserInfo); | 155 | _server.SendPacket(TransferPacket, true, userInfo); |
155 | } | 156 | } |
156 | else | 157 | else |
157 | { | 158 | { |
158 | TransferPacket.TransferData.Status=1; //last packet? so set to 1 | 159 | TransferPacket.TransferData.Status = 1; //last packet? so set to 1 |
159 | TransferPacket.TransferData.Data=info.data; | 160 | TransferPacket.TransferData.Data = info.data; |
160 | server.SendPacket(TransferPacket, true, UserInfo); | 161 | _server.SendPacket(TransferPacket, true, userInfo); |
161 | } | 162 | } |
162 | 163 | ||
163 | } | 164 | } |
164 | 165 | ||
165 | public void CreateNewInventorySet(ref AvatarData Avata,User_Agent_info UserInfo) | 166 | public void CreateNewInventorySet(ref AvatarData Avata,UserAgentInfo UserInfo) |
166 | { | 167 | { |
167 | //Create Folders | 168 | //Create Folders |
168 | LLUUID BaseFolder=Avata.BaseFolder; | 169 | LLUUID BaseFolder = Avata.BaseFolder; |
169 | InventoryManager.CreateNewFolder(UserInfo, Avata.InventoryFolder); | 170 | _inventoryManager.CreateNewFolder(UserInfo, Avata.InventoryFolder); |
170 | InventoryManager.CreateNewFolder(UserInfo, BaseFolder); | 171 | _inventoryManager.CreateNewFolder(UserInfo, BaseFolder); |
171 | 172 | ||
172 | //Give a copy of default shape | 173 | //Give a copy of default shape |
173 | AssetInfo Base=this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")]; | 174 | AssetInfo Base = this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")]; |
174 | AssetInfo Shape=this.CloneAsset(UserInfo.AgentID, Base); | 175 | AssetInfo Shape = this.CloneAsset(UserInfo.AgentID, Base); |
175 | 176 | ||
176 | Shape.filename=""; | 177 | Shape.filename = ""; |
177 | Shape.Name="Default Shape"; | 178 | Shape.Name = "Default Shape"; |
178 | Shape.Description="Default Shape"; | 179 | Shape.Description = "Default Shape"; |
179 | Shape.InvType=18; | 180 | Shape.InvType = 18; |
180 | Shape.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY; | 181 | Shape.Type = libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY; |
181 | 182 | ||
182 | byte[] Agentid=enc.GetBytes(UserInfo.AgentID.ToStringHyphenated()); | 183 | byte[] Agentid = _enc.GetBytes(UserInfo.AgentID.ToStringHyphenated()); |
183 | Array.Copy(Agentid, 0, Shape.data, 294, Agentid.Length); | 184 | Array.Copy(Agentid, 0, Shape.data, 294, Agentid.Length); |
184 | this.Assets.Add(Shape.Full_ID, Shape); | 185 | this.Assets.Add(Shape.FullID, Shape); |
185 | 186 | ||
186 | Avata.Wearables[0].ItemID=InventoryManager.AddToInventory(UserInfo, BaseFolder, Shape); | 187 | Avata.Wearables[0].ItemID = _inventoryManager.AddToInventory(UserInfo, BaseFolder, Shape); |
187 | Avata.Wearables[0].AssetID=Shape.Full_ID; | 188 | Avata.Wearables[0].AssetID = Shape.FullID; |
188 | 189 | ||
189 | //Give copy of default skin | 190 | //Give copy of default skin |
190 | Base=this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")]; | 191 | Base = this.Assets[new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")]; |
191 | AssetInfo Skin=this.CloneAsset(UserInfo.AgentID, Base); | 192 | AssetInfo Skin=this.CloneAsset(UserInfo.AgentID, Base); |
192 | 193 | ||
193 | Skin.filename=""; | 194 | Skin.filename = ""; |
194 | Skin.Name="Default Skin"; | 195 | Skin.Name = "Default Skin"; |
195 | Skin.Description="Default Skin"; | 196 | Skin.Description = "Default Skin"; |
196 | Skin.InvType=18; | 197 | Skin.InvType = 18; |
197 | Skin.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY; | 198 | Skin.Type = libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY; |
198 | 199 | ||
199 | Array.Copy(Agentid,0,Skin.data,238,Agentid.Length); | 200 | Array.Copy(Agentid,0,Skin.data,238,Agentid.Length); |
200 | this.Assets.Add(Skin.Full_ID, Skin); | 201 | this.Assets.Add(Skin.FullID, Skin); |
201 | 202 | ||
202 | Avata.Wearables[1].ItemID=InventoryManager.AddToInventory(UserInfo, BaseFolder, Skin); | 203 | Avata.Wearables[1].ItemID = _inventoryManager.AddToInventory(UserInfo, BaseFolder, Skin); |
203 | Avata.Wearables[1].AssetID=Skin.Full_ID; | 204 | Avata.Wearables[1].AssetID = Skin.FullID; |
204 | 205 | ||
205 | //give a copy of test texture | 206 | //give a copy of test texture |
206 | TextureImage Texture=this.CloneImage(UserInfo.AgentID,Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]); | 207 | TextureImage Texture = this.CloneImage(UserInfo.AgentID, Textures[new LLUUID("00000000-0000-0000-5005-000000000005")]); |
207 | this.Textures.Add(Texture.Full_ID, Texture); | 208 | this.Textures.Add(Texture.FullID, Texture); |
208 | InventoryManager.AddToInventory(UserInfo, BaseFolder, Texture); | 209 | _inventoryManager.AddToInventory(UserInfo, BaseFolder, Texture); |
209 | 210 | ||
210 | } | 211 | } |
211 | 212 | ||
@@ -217,116 +218,116 @@ namespace OpenSim | |||
217 | string folder; | 218 | string folder; |
218 | if(Image) | 219 | if(Image) |
219 | { | 220 | { |
220 | folder=@"\textures\"; | 221 | folder = @"\textures\"; |
221 | } | 222 | } |
222 | else | 223 | else |
223 | { | 224 | { |
224 | folder=@"\assets\"; | 225 | folder = @"\assets\"; |
225 | } | 226 | } |
226 | string data_path = System.AppDomain.CurrentDomain.BaseDirectory + folder; | 227 | string data_path = System.AppDomain.CurrentDomain.BaseDirectory + folder; |
227 | string filename=data_path+@info.filename; | 228 | string filename = data_path+@info.filename; |
228 | FileInfo fInfo = new FileInfo(filename); | 229 | FileInfo fInfo = new FileInfo(filename); |
229 | 230 | ||
230 | long numBytes = fInfo.Length; | 231 | long numBytes = fInfo.Length; |
231 | 232 | ||
232 | FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read); | 233 | FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read); |
233 | byte[] idata=new byte[numBytes]; | 234 | byte[] idata = new byte[numBytes]; |
234 | BinaryReader br = new BinaryReader(fStream); | 235 | BinaryReader br = new BinaryReader(fStream); |
235 | idata= br.ReadBytes((int)numBytes); | 236 | idata= br.ReadBytes((int)numBytes); |
236 | br.Close(); | 237 | br.Close(); |
237 | fStream.Close(); | 238 | fStream.Close(); |
238 | info.data=idata; | 239 | info.data = idata; |
239 | //info.loaded=true; | 240 | //info.loaded=true; |
240 | } | 241 | } |
241 | 242 | ||
242 | public AssetInfo CloneAsset(LLUUID NewOwner, AssetInfo SourceAsset) | 243 | public AssetInfo CloneAsset(LLUUID NewOwner, AssetInfo SourceAsset) |
243 | { | 244 | { |
244 | AssetInfo NewAsset=new AssetInfo(); | 245 | AssetInfo NewAsset = new AssetInfo(); |
245 | NewAsset.data=new byte[SourceAsset.data.Length]; | 246 | NewAsset.data = new byte[SourceAsset.data.Length]; |
246 | Array.Copy(SourceAsset.data,NewAsset.data,SourceAsset.data.Length); | 247 | Array.Copy(SourceAsset.data, NewAsset.data, SourceAsset.data.Length); |
247 | NewAsset.Full_ID=LLUUID.Random(); | 248 | NewAsset.FullID = LLUUID.Random(); |
248 | NewAsset.Type=SourceAsset.Type; | 249 | NewAsset.Type = SourceAsset.Type; |
249 | NewAsset.InvType=SourceAsset.InvType; | 250 | NewAsset.InvType = SourceAsset.InvType; |
250 | return(NewAsset); | 251 | return(NewAsset); |
251 | } | 252 | } |
252 | #endregion | 253 | #endregion |
253 | 254 | ||
254 | #region TextureRegion | 255 | #region TextureRegion |
255 | public void AddTextureRequest(User_Agent_info user, LLUUID image_id) | 256 | public void AddTextureRequest(UserAgentInfo userInfo, LLUUID imageID) |
256 | { | 257 | { |
257 | 258 | ||
258 | if(!this.Textures.ContainsKey(image_id)) | 259 | if(!this.Textures.ContainsKey(imageID)) |
259 | { | 260 | { |
260 | //not found image so send back image not in data base message | 261 | //not found image so send back image not in data base message |
261 | ImageNotInDatabasePacket im_not=new ImageNotInDatabasePacket(); | 262 | ImageNotInDatabasePacket im_not = new ImageNotInDatabasePacket(); |
262 | im_not.ImageID.ID=image_id; | 263 | im_not.ImageID.ID=imageID; |
263 | server.SendPacket(im_not, true, user); | 264 | _server.SendPacket(im_not, true, userInfo); |
264 | return; | 265 | return; |
265 | } | 266 | } |
266 | TextureImage imag=this.Textures[image_id]; | 267 | TextureImage imag = this.Textures[imageID]; |
267 | TextureRequest req=new TextureRequest(); | 268 | TextureRequest req = new TextureRequest(); |
268 | req.RequestUser=user; | 269 | req.RequestUser = userInfo; |
269 | req.RequestImage=image_id; | 270 | req.RequestImage = imageID; |
270 | req.image_info=imag; | 271 | req.image_info = imag; |
271 | 272 | ||
272 | if(imag.data.LongLength>1000) //should be bigger or smaller? | 273 | if(imag.data.LongLength>1000) //should be bigger or smaller? |
273 | { | 274 | { |
274 | //over 1000 bytes so split up file | 275 | //over 1000 bytes so split up file |
275 | req.num_packets=(int)imag.data.LongLength/1000; | 276 | req.num_packets = (int)imag.data.LongLength/1000; |
276 | req.num_packets++; | 277 | req.num_packets++; |
277 | } | 278 | } |
278 | else | 279 | else |
279 | { | 280 | { |
280 | req.num_packets=1; | 281 | req.num_packets = 1; |
281 | } | 282 | } |
282 | 283 | ||
283 | this.TextureRequests.Add(req); | 284 | this.TextureRequests.Add(req); |
284 | 285 | ||
285 | } | 286 | } |
286 | 287 | ||
287 | public void AddTexture(LLUUID image_id, string name, byte[] data) | 288 | public void AddTexture(LLUUID imageID, string name, byte[] data) |
288 | { | 289 | { |
289 | 290 | ||
290 | } | 291 | } |
291 | public void DoWork(ulong time) | 292 | public void DoWork(ulong time) |
292 | { | 293 | { |
293 | if(this.TextureRequests.Count==0) | 294 | if(this.TextureRequests.Count == 0) |
294 | { | 295 | { |
295 | //no requests waiting | 296 | //no requests waiting |
296 | return; | 297 | return; |
297 | } | 298 | } |
298 | int num; | 299 | int num; |
299 | //should be running in its own thread but for now is called by timer | 300 | //should be running in its own thread but for now is called by timer |
300 | if(this.TextureRequests.Count<5) | 301 | if(this.TextureRequests.Count < 5) |
301 | { | 302 | { |
302 | //lower than 5 so do all of them | 303 | //lower than 5 so do all of them |
303 | num=this.TextureRequests.Count; | 304 | num = this.TextureRequests.Count; |
304 | } | 305 | } |
305 | else | 306 | else |
306 | { | 307 | { |
307 | num=5; | 308 | num=5; |
308 | } | 309 | } |
309 | TextureRequest req; | 310 | TextureRequest req; |
310 | for(int i=0; i<num; i++) | 311 | for(int i = 0; i < num; i++) |
311 | { | 312 | { |
312 | req=(TextureRequest)this.TextureRequests[i]; | 313 | req=(TextureRequest)this.TextureRequests[i]; |
313 | 314 | ||
314 | if(req.packet_counter==0) | 315 | if(req.packet_counter == 0) |
315 | { | 316 | { |
316 | //first time for this request so send imagedata packet | 317 | //first time for this request so send imagedata packet |
317 | if(req.num_packets==1) | 318 | if(req.num_packets == 1) |
318 | { | 319 | { |
319 | //only one packet so send whole file | 320 | //only one packet so send whole file |
320 | ImageDataPacket im=new ImageDataPacket(); | 321 | ImageDataPacket im = new ImageDataPacket(); |
321 | im.ImageID.Packets=1; | 322 | im.ImageID.Packets = 1; |
322 | im.ImageID.ID=req.image_info.Full_ID; | 323 | im.ImageID.ID = req.image_info.FullID; |
323 | im.ImageID.Size=(uint)req.image_info.data.Length; | 324 | im.ImageID.Size = (uint)req.image_info.data.Length; |
324 | im.ImageData.Data=req.image_info.data; | 325 | im.ImageData.Data = req.image_info.data; |
325 | im.ImageID.Codec=2; | 326 | im.ImageID.Codec = 2; |
326 | server.SendPacket(im,true,req.RequestUser); | 327 | _server.SendPacket(im, true, req.RequestUser); |
327 | req.packet_counter++; | 328 | req.packet_counter++; |
328 | req.image_info.last_used=time; | 329 | req.image_info.last_used = time; |
329 | System.Console.WriteLine("sent texture: "+req.image_info.Full_ID); | 330 | System.Console.WriteLine("sent texture: "+req.image_info.FullID); |
330 | } | 331 | } |
331 | else | 332 | else |
332 | { | 333 | { |
@@ -341,10 +342,10 @@ namespace OpenSim | |||
341 | } | 342 | } |
342 | 343 | ||
343 | //remove requests that have been completed | 344 | //remove requests that have been completed |
344 | for(int i=0; i<num; i++) | 345 | for(int i = 0; i < num; i++) |
345 | { | 346 | { |
346 | req=(TextureRequest)this.TextureRequests[i]; | 347 | req=(TextureRequest)this.TextureRequests[i]; |
347 | if(req.packet_counter==req.num_packets) | 348 | if(req.packet_counter == req.num_packets) |
348 | { | 349 | { |
349 | this.TextureRequests.Remove(req); | 350 | this.TextureRequests.Remove(req); |
350 | } | 351 | } |
@@ -356,15 +357,15 @@ namespace OpenSim | |||
356 | 357 | ||
357 | } | 358 | } |
358 | 359 | ||
359 | public TextureImage CloneImage(LLUUID NewOwner,TextureImage Source) | 360 | public TextureImage CloneImage(LLUUID newOwner, TextureImage source) |
360 | { | 361 | { |
361 | TextureImage NewImage=new TextureImage(); | 362 | TextureImage newImage = new TextureImage(); |
362 | NewImage.data=new byte[Source.data.Length]; | 363 | newImage.data = new byte[source.data.Length]; |
363 | Array.Copy(Source.data,NewImage.data,Source.data.Length); | 364 | Array.Copy(source.data,newImage.data,source.data.Length); |
364 | NewImage.filename=Source.filename; | 365 | newImage.filename = source.filename; |
365 | NewImage.Full_ID=LLUUID.Random(); | 366 | newImage.FullID = LLUUID.Random(); |
366 | NewImage.Name=Source.Name; | 367 | newImage.Name = source.Name; |
367 | return(NewImage); | 368 | return(newImage); |
368 | } | 369 | } |
369 | 370 | ||
370 | #endregion | 371 | #endregion |
@@ -372,12 +373,12 @@ namespace OpenSim | |||
372 | 373 | ||
373 | public class AssetRequest | 374 | public class AssetRequest |
374 | { | 375 | { |
375 | public User_Agent_info RequestUser; | 376 | public UserAgentInfo RequestUser; |
376 | public LLUUID RequestImage; | 377 | public LLUUID RequestImage; |
377 | public AssetInfo asset_inf; | 378 | public AssetInfo asset_inf; |
378 | public long data_pointer=0; | 379 | public long data_pointer = 0; |
379 | public int num_packets=0; | 380 | public int num_packets = 0; |
380 | public int packet_counter=0; | 381 | public int packet_counter = 0; |
381 | 382 | ||
382 | public AssetRequest() | 383 | public AssetRequest() |
383 | { | 384 | { |
@@ -401,7 +402,7 @@ namespace OpenSim | |||
401 | public class AssetBase | 402 | public class AssetBase |
402 | { | 403 | { |
403 | public byte[] data; | 404 | public byte[] data; |
404 | public LLUUID Full_ID; | 405 | public LLUUID FullID; |
405 | public sbyte Type; | 406 | public sbyte Type; |
406 | public sbyte InvType; | 407 | public sbyte InvType; |
407 | public string Name; | 408 | public string Name; |
@@ -413,14 +414,14 @@ namespace OpenSim | |||
413 | 414 | ||
414 | } | 415 | } |
415 | } | 416 | } |
416 | public class TextureRequest | 417 | public class TextureRequest |
417 | { | 418 | { |
418 | public User_Agent_info RequestUser; | 419 | public UserAgentInfo RequestUser; |
419 | public LLUUID RequestImage; | 420 | public LLUUID RequestImage; |
420 | public TextureImage image_info; | 421 | public TextureImage image_info; |
421 | public long data_pointer=0; | 422 | public long data_pointer = 0; |
422 | public int num_packets=0; | 423 | public int num_packets = 0; |
423 | public int packet_counter=0; | 424 | public int packet_counter = 0; |
424 | 425 | ||
425 | public TextureRequest() | 426 | public TextureRequest() |
426 | { | 427 | { |
@@ -435,7 +436,7 @@ namespace OpenSim | |||
435 | //public string name; | 436 | //public string name; |
436 | public bool loaded; | 437 | public bool loaded; |
437 | public ulong last_used; //need to add a tick/time counter and keep record | 438 | public ulong last_used; //need to add a tick/time counter and keep record |
438 | // of how often images are requested to unload unused ones. | 439 | // of how often images are requested to unload unused ones. |
439 | 440 | ||
440 | public TextureImage() | 441 | public TextureImage() |
441 | { | 442 | { |