private Asset CreateAssetWrapper(AssetType type) { Asset asset; switch (type) { case AssetType.Notecard: asset = new AssetNotecard(); break; case AssetType.LSLText: asset = new AssetScriptText(); break; case AssetType.LSLBytecode: asset = new AssetScriptBinary(); break; case AssetType.Texture: asset = new AssetTexture(); break; case AssetType.Primitive: asset = new AssetPrim(); break; case AssetType.Clothing: asset = new AssetClothing(); break; case AssetType.Bodypart: asset = new AssetBodypart(); break; default: Client.Log("Unimplemented asset type: " + type, Helpers.LogLevel.Error); return null; } return asset; }
//Separate thread private void Assets_OnAssetReceived(AssetDownload transfer, Asset asset) { if (transfer.ID != transferID) return; string scriptContent; if (!transfer.Success) { scriptContent = "Unable to download script. Make sure you have the proper permissions!"; BeginInvoke(new OnSetScriptText(SetScriptText), new object[] { scriptContent, true }); return; } receivedAsset = (AssetScriptText)asset; scriptContent = Helpers.FieldToUTF8String(transfer.AssetData); BeginInvoke(new OnSetScriptText(SetScriptText), new object[] { scriptContent, false }); }