Beispiel #1
0
        private void Asset_Xfer(object sender, XferReceivedEventArgs e)
        {
            if (!IsExporting)
            {
                return;
            }
            UUID assetID   = GetAssetID(e.Xfer);
            var  assetType = e.Xfer.AssetType;

            if (assetType == AssetType.Unknown)
            {
                // probly an taskinv so ingnore
                return;
            }
            lock (ToDownloadAssets) if (e.Xfer.Success)
                {
                    AssetComplete(assetID);
                    string sfile = SimAsset.CFileName(assetID, assetType);
                    try
                    {
                        lock (fileWriterLock)
                            File.WriteAllBytes(assetDumpDir + Path.GetFileName(sfile), e.Xfer.AssetData);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(ex.Message, Helpers.LogLevel.Error);
                    }
                }
        }
Beispiel #2
0
 private void xferCallback(object sender, XferReceivedEventArgs e)
 {
     if (e.Xfer.XferID == _xferID)
     {
         Importing.Client.Assets.XferReceived -= xferCallback;
         if (e.Xfer.Error != TransferError.None)
         {
             sourceObjectinventory = SimObjectImpl.ERROR_TASK_INV;
             taskInvRequestRelpy.Set();
             return;
         }
         String taskList = Utils.BytesToString(e.Xfer.AssetData);
         sourceObjectinventory = InventoryManager.ParseTaskInventory(taskList);
         taskInvRequestRelpy.Set();
     }
 }
Beispiel #3
0
        /// <summary>
        /// Handle the reply to the OnXferReceived event
        /// </summary>
        private void Assets_XferReceived(object sender, XferReceivedEventArgs e)
        {
            if (e.Xfer.Success)
            {
                // set the result message
                result.AppendFormat("Terrain file {0} ({1} bytes) downloaded successfully, written to {2}", e.Xfer.Filename, e.Xfer.Size, fileName);

                // write the file to disk
                FileStream   stream = new FileStream(fileName, FileMode.Create);
                BinaryWriter w      = new BinaryWriter(stream);
                w.Write(e.Xfer.AssetData);
                w.Close();

                // tell the application we've gotten the file
                xferTimeout.Set();
            }
        }