public void OnDownloaded(AssetDownload transfer, Asset asset)
            {
                if (transfer.AssetID != NewID)
                {
                    return;
                }
                if (assetType == AssetType.Texture && !asset.Decode())
                {
                    Difference(asset.AssetData, AssetData);
                    asset.AssetData = AssetData;
                    if (false)
                    {
                        Inventory.RemoveItem(NewItemID);
                        NewItemID = UUID.Zero;
                        NewID     = UUID.Zero;
                        UploadAssetData(false);

                        /*Inventory.RequestCreateItemFromAsset(AssetData, "" + OldID, ProgressString,
                         *                                   assetType, inventoryType,
                         *                                   GetAssetUploadsFolder(),
                         *                                   Permissions.FullPermissions,
                         *                                   InvItemCreated);*/
                        //UpdateAsset(AssetData);
                        return;
                    }
                }
                if (!transfer.Success)
                {
                    Importing.Error(ExportCommand.Exporting.LocalFailure, "bad transfer on " + this);
                }
                else
                {
                    WriteProgress();
                }
                _NewItem = asset;
                NewUUID2OBJECT[NewID] = this;
                UUID2OBJECT[OldID]    = this;
                AssetUploaded.Set();
            }
 public bool UploadAssetData(bool storeLocal)
 {
     if (IsLocalScene)
     {
         ReplaceAll();
         RezRequested = true;
         NewID        = OldID;
         _NewItem     = OldItem;
         return(true);
     }
     if (CogbotHelpers.IsNullOrZero(NewID))
     {
         if (UseUploadKnown)
         {
             AssetUploaded.Reset();
             if (assetType == AssetType.Notecard)
             {
                 Inventory.RequestCreateItem(GetAssetUploadsFolder(), "" + OldID,
                                             Description, assetType, UUID.Zero,
                                             OpenMetaverse.InventoryType.Notecard,
                                             PermissionMask.All, UpdateInvItem);
             }
             else if (assetType == AssetType.Gesture)
             {
                 Inventory.RequestCreateItem(GetAssetUploadsFolder(), "" + OldID,
                                             Description, assetType, UUID.Zero,
                                             OpenMetaverse.InventoryType.Gesture,
                                             PermissionMask.All, UpdateInvItem);
                 // (gesture.Sequence)
             }
             else if (assetType == AssetType.LSLText)
             {
                 Inventory.RequestCreateItem(GetAssetUploadsFolder(), "" + OldID,
                                             Description, assetType, UUID.Zero,
                                             OpenMetaverse.InventoryType.LSL,
                                             PermissionMask.All, UpdateInvItem);
             }
             else if (assetType == AssetType.Landmark)
             {
                 var decodeME = new AssetLandmark(UUID.Zero, AssetData);
                 decodeME.Decode();
                 byte[] bytes = AssetData;
                 Inventory.RequestCreateItem(GetAssetUploadsFolder(), "" + OldID,
                                             "RegionID:" + decodeME.RegionID + ",Postion" + decodeME.Position +
                                             "," + DateTime.Now, assetType, UUID.Zero,
                                             OpenMetaverse.InventoryType.Landmark,
                                             PermissionMask.All, UpdateInvItem);
             }
             else if (assetType == AssetType.CallingCard)
             {
                 var decodeME = new AssetCallingCard(UUID.Zero, AssetData);
                 decodeME.Decode();
                 byte[] bytes = AssetData;
                 Inventory.RequestCreateItem(GetAssetUploadsFolder(), "" + OldID,
                                             "AvatarID:" + decodeME.AvatarID + "," + DateTime.Now,
                                             assetType, UUID.Zero,
                                             OpenMetaverse.InventoryType.CallingCard,
                                             PermissionMask.All, UpdateInvItem);
             }
             else
             {
                 Inventory.RequestCreateItemFromAsset(AssetData, "" + OldID, Description,
                                                      assetType, inventoryType,
                                                      GetAssetUploadsFolder(),
                                                      Permissions.FullPermissions,
                                                      InvItemCreated);
             }
             if (!AssetUploaded.WaitOne(10000))
             {
                 return(false);
             }
             return(true);
         }
         NewID = UUID.Combine(OldID, Importing.Client.Self.SecureSessionID);
         NewUUID2OBJECT[NewID] = this;
         Importing.Client.Assets.RequestUploadKnown(NewID, assetType, AssetData, storeLocal, OldID);
         RezRequested = true;
     }
     return(true);
 }