aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/AgentAssetUpload.cs
diff options
context:
space:
mode:
authorMW2007-03-31 09:14:07 +0000
committerMW2007-03-31 09:14:07 +0000
commit8c5b51b7c0999de87641163b107071e3b1a410fb (patch)
tree4760dc5aff1d2ae0e963977d9d5a76ea8e2a4fc8 /OpenSim.RegionServer/AgentAssetUpload.cs
parent* cleared some unused code away (diff)
downloadopensim-SC-8c5b51b7c0999de87641163b107071e3b1a410fb.zip
opensim-SC-8c5b51b7c0999de87641163b107071e3b1a410fb.tar.gz
opensim-SC-8c5b51b7c0999de87641163b107071e3b1a410fb.tar.bz2
opensim-SC-8c5b51b7c0999de87641163b107071e3b1a410fb.tar.xz
Diffstat (limited to 'OpenSim.RegionServer/AgentAssetUpload.cs')
-rw-r--r--OpenSim.RegionServer/AgentAssetUpload.cs79
1 files changed, 39 insertions, 40 deletions
diff --git a/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim.RegionServer/AgentAssetUpload.cs
index 722da53..491d50b 100644
--- a/OpenSim.RegionServer/AgentAssetUpload.cs
+++ b/OpenSim.RegionServer/AgentAssetUpload.cs
@@ -74,29 +74,29 @@ namespace OpenSim
74 AssetBase asset = null; 74 AssetBase asset = null;
75 if (pack.AssetBlock.Type == 0) 75 if (pack.AssetBlock.Type == 0)
76 { 76 {
77 77
78 //first packet for transaction 78 //first packet for transaction
79 asset = new AssetBase(); 79 asset = new AssetBase();
80 asset.FullID = assetID; 80 asset.FullID = assetID;
81 asset.Type = pack.AssetBlock.Type; 81 asset.Type = pack.AssetBlock.Type;
82 asset.InvType = asset.Type; 82 asset.InvType = asset.Type;
83 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); 83 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
84 asset.Data = pack.AssetBlock.AssetData; 84 asset.Data = pack.AssetBlock.AssetData;
85 85
86 86
87 } 87 }
88 else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7) 88 else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7)
89 { 89 {
90 90
91 asset = new AssetBase(); 91 asset = new AssetBase();
92 asset.FullID = assetID; 92 asset.FullID = assetID;
93 // Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated()); 93 // Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated());
94 asset.Type = pack.AssetBlock.Type; 94 asset.Type = pack.AssetBlock.Type;
95 asset.InvType = asset.Type ; 95 asset.InvType = asset.Type;
96 asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000"); 96 asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000");
97 asset.Data = pack.AssetBlock.AssetData; 97 asset.Data = pack.AssetBlock.AssetData;
98 98
99 99
100 } 100 }
101 101
102 if (asset != null) 102 if (asset != null)
@@ -105,7 +105,7 @@ namespace OpenSim
105 } 105 }
106 else 106 else
107 { 107 {
108 108
109 //currently we don't support this asset type 109 //currently we don't support this asset type
110 //so lets just tell the client that the upload is complete 110 //so lets just tell the client that the upload is complete
111 AssetUploadCompletePacket response = new AssetUploadCompletePacket(); 111 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
@@ -136,8 +136,8 @@ namespace OpenSim
136 } 136 }
137 else 137 else
138 { 138 {
139 byte[] newArray = new byte[xferPacket.DataPacket.Data.Length-4]; 139 byte[] newArray = new byte[xferPacket.DataPacket.Data.Length - 4];
140 Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length-4); 140 Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length - 4);
141 trans.Asset.Data = newArray; 141 trans.Asset.Data = newArray;
142 } 142 }
143 143
@@ -155,11 +155,11 @@ namespace OpenSim
155 //check if we should add it to inventory 155 //check if we should add it to inventory
156 if (trans.AddToInventory) 156 if (trans.AddToInventory)
157 { 157 {
158 // m_assetCache.AddAsset(trans.Asset); 158 // m_assetCache.AddAsset(trans.Asset);
159 m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); 159 m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset);
160 } 160 }
161 161
162 162
163 } 163 }
164 break; 164 break;
165 } 165 }
@@ -178,7 +178,7 @@ namespace OpenSim
178 public AssetBase AddUploadToAssetCache(LLUUID transactionID) 178 public AssetBase AddUploadToAssetCache(LLUUID transactionID)
179 { 179 {
180 AssetBase asset = null; 180 AssetBase asset = null;
181 if(this.transactions.ContainsKey(transactionID)) 181 if (this.transactions.ContainsKey(transactionID))
182 { 182 {
183 AssetTransaction trans = this.transactions[transactionID]; 183 AssetTransaction trans = this.transactions[transactionID];
184 if (trans.UploadComplete) 184 if (trans.UploadComplete)
@@ -193,7 +193,7 @@ namespace OpenSim
193 193
194 public void CreateInventoryItem(CreateInventoryItemPacket packet) 194 public void CreateInventoryItem(CreateInventoryItemPacket packet)
195 { 195 {
196 if(this.transactions.ContainsKey(packet.InventoryBlock.TransactionID)) 196 if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID))
197 { 197 {
198 AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID]; 198 AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID];
199 trans.Asset.Description = Helpers.FieldToString(packet.InventoryBlock.Description); 199 trans.Asset.Description = Helpers.FieldToString(packet.InventoryBlock.Description);
@@ -204,7 +204,7 @@ namespace OpenSim
204 { 204 {
205 //already complete so we can add it to the inventory 205 //already complete so we can add it to the inventory
206 //m_assetCache.AddAsset(trans.Asset); 206 //m_assetCache.AddAsset(trans.Asset);
207 Console.WriteLine( "Item created is " +m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated()); 207 Console.WriteLine("Item created is " + m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated());
208 } 208 }
209 else 209 else
210 { 210 {
@@ -214,20 +214,19 @@ namespace OpenSim
214 } 214 }
215 } 215 }
216 216
217 } 217 private class AssetTransaction
218
219 public class AssetTransaction
220 {
221 public uint XferID;
222 public AssetBase Asset;
223 public bool AddToInventory;
224 public LLUUID InventFolder = LLUUID.Zero;
225 public bool UploadComplete = false;
226 public LLUUID TransactionID = LLUUID.Zero;
227
228 public AssetTransaction()
229 { 218 {
219 public uint XferID;
220 public AssetBase Asset;
221 public bool AddToInventory;
222 public LLUUID InventFolder = LLUUID.Zero;
223 public bool UploadComplete = false;
224 public LLUUID TransactionID = LLUUID.Zero;
225
226 public AssetTransaction()
227 {
230 228
229 }
231 } 230 }
232 } 231 }
233} 232}