private void CompleteCreateItem(uint callbackID) { m_Scene.AssetService.Store(m_asset); InventoryItemBase item = new InventoryItemBase(); item.Owner = ourClient.AgentId; item.CreatorId = ourClient.AgentId.ToString(); item.ID = UUID.Random(); item.AssetID = m_asset.FullID; item.Description = m_description; item.Name = m_name; item.AssetType = type; item.InvType = invType; item.Folder = InventFolder; item.BasePermissions = (uint)(PermissionMask.All | PermissionMask.Export); item.CurrentPermissions = item.BasePermissions; item.GroupPermissions = 0; item.EveryOnePermissions = 0; item.NextPermissions = nextPerm; item.Flags = (uint)wearableType; item.CreationDate = Util.UnixTimeSinceEpoch(); if (m_Scene.AddInventoryItem(item)) { ourClient.SendInventoryItemCreateUpdate(item, callbackID); } else { ourClient.SendAlertMessage("Unable to create inventory item"); } m_transactions.RemoveXferUploader(m_transactionID); }
/// <summary> /// Store the asset for the given item when it has been uploaded. /// </summary> /// <param name="item"></param> private void CompleteItemUpdate(InventoryItemBase item) { // m_log.DebugFormat( // "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}", // m_asset.FullID, item.Name, ourClient.Name); m_Scene.AssetService.Store(m_asset); m_transactions.RemoveXferUploader(m_transactionID); }
/// <summary> /// Store the asset for the given item when it has been uploaded. /// </summary> /// <param name="item"></param> private void CompleteItemUpdate(InventoryItemBase item) { // m_log.DebugFormat( // "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}", // m_asset.FullID, item.Name, ourClient.Name); ValidateAssets(); m_Scene.AssetService.Store(m_asset); if (m_asset.FullID != UUID.Zero) { item.AssetID = m_asset.FullID; m_Scene.InventoryService.UpdateItem(item); } ourClient.SendInventoryItemCreateUpdate(item, m_transactionID, 0); m_transactions.RemoveXferUploader(m_transactionID); m_Scene.EventManager.TriggerOnNewInventoryItemUploadComplete(item, 0); }
/// <summary> /// Store the asset for the given item when it has been uploaded. /// </summary> /// <param name="item"></param> private bool CompleteItemUpdate(InventoryItemBase item) { // m_log.DebugFormat( // "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}", // m_asset.FullID, item.Name, ourClient.Name); uint perms = ValidateAssets(); if (perms == 0) { string error = string.Format("Not enough permissions on asset(s) referenced by item '{0}', update failed", item.Name); ourClient.SendAlertMessage(error); m_transactions.RemoveXferUploader(m_transactionID); ourClient.SendBulkUpdateInventory(item); // invalid the change item on viewer cache } else { m_Scene.AssetService.Store(m_asset); if (m_asset.FullID != UUID.Zero) { item.AssetID = m_asset.FullID; m_Scene.InventoryService.UpdateItem(item); } ourClient.SendInventoryItemCreateUpdate(item, m_transactionID, 0); m_transactions.RemoveXferUploader(m_transactionID); m_Scene.EventManager.TriggerOnNewInventoryItemUploadComplete(item, 0); } return(perms != 0); }
protected void SendCompleteMessage() { ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID); // We must lock in order to avoid a race with a separate thread dealing with an inventory item or create // message from other client UDP. lock (this) { m_finished = true; if (m_createItem) { DoCreateItem(m_createItemCallback); } else if (m_updateItem) { StoreAssetForItemUpdate(m_updateItemData); // Remove ourselves from the list of transactions if completion was delayed until the transaction // was complete. // TODO: Should probably do the same for create item. m_transactions.RemoveXferUploader(TransactionID); } else if (m_storeLocal) { m_Scene.AssetService.Store(m_asset); } } m_log.DebugFormat( "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}", m_asset.FullID, TransactionID); if (m_dumpAssetToFile) { DateTime now = DateTime.Now; string filename = String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, m_asset.Name, m_asset.Type); SaveAssetToFile(filename, m_asset.Data); } }