Provides data for XferReceived event
Inheritance: System.EventArgs
Beispiel #1
0
 /// <summary>Raises the XferReceived event</summary>
 /// <param name="e">A XferReceivedEventArgs object containing the
 /// data returned from the simulator</param>
 protected virtual void OnXferReceived(XferReceivedEventArgs e)
 {
     EventHandler<XferReceivedEventArgs> handler = m_XferReceivedEvent;
     if (handler != null)
         handler(this, e);
 }
 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
 public virtual void Assets_OnXferReceived(object sender, XferReceivedEventArgs e) { OnEvent("On-Xfer-Received", paramNamesOnXferReceived, paramTypesOnXferReceived, e.Xfer); }
        /// <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();
            }
        }
 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);
             }
         }
 }