示例#1
0
 /// <summary>
 /// Unregister a CAPS event handler. This is a low level event interface
 /// and should only be used if you are doing something not supported in
 /// libsecondlife
 /// </summary>
 /// <param name="capsEvent">Name of the CAPS event this callback is
 /// registered with</param>
 /// <param name="callback">Callback to stop firing events for</param>
 public void UnregisterEventCallback(string capsEvent, Capabilities.EventQueueCallback callback)
 {
     CapsEvents.UnregisterEvent(capsEvent, callback);
 }
示例#2
0
        /// <summary>
        /// Disconnect from this simulator
        /// </summary>
        public void Disconnect(bool sendCloseCircuit)
        {
            if (connected)
            {
                connected = false;

                AckTimer.Stop();
                StatsTimer.Stop();
                if (Client.Settings.SEND_PINGS) PingTimer.Stop();

                // Kill the current CAPS system
                if (Caps != null)
                {
                    Caps.Disconnect(true);
                    Caps = null;
                }

                if (sendCloseCircuit)
                {
                    // Try to send the CloseCircuit notice
                    CloseCircuitPacket close = new CloseCircuitPacket();
                    UDPPacketBuffer buf = new UDPPacketBuffer(ipEndPoint, false);
                    buf.Data = close.ToBytes();
                    buf.DataLength = buf.Data.Length;

                    AsyncBeginSend(buf);
                }

                // Shut the socket communication down
                Stop();
            }
        }
示例#3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="capsEvent">Capability event name unregister the 
 /// handler for</param>
 /// <param name="eventHandler">Callback to unregister</param>
 public void UnregisterEvent(string capsEvent, Capabilities.EventQueueCallback eventHandler)
 {
     lock (_EventTable)
     {
         if (_EventTable.ContainsKey(capsEvent) && _EventTable[capsEvent] != null)
             _EventTable[capsEvent] -= eventHandler;
     }
 }
示例#4
0
        public void SetSeedCaps(string seedcaps)
        {
            if (Caps != null)
            {
                if (Caps._SeedCapsURI == seedcaps) return;

                Client.Log("Unexpected change of seed capability", Helpers.LogLevel.Warning);
                Caps.Disconnect(true);
                Caps = null;
            }

            if (Client.Settings.ENABLE_CAPS)
            {
                // Connect to the new CAPS system
                if (!String.IsNullOrEmpty(seedcaps))
                    Caps = new Capabilities(this, seedcaps);
                else
                    Client.Log("Setting up a sim without a valid capabilities server!", Helpers.LogLevel.Error);
            }

        }
示例#5
0
 /// <summary>
 /// Register an event handler
 /// </summary>
 /// <remarks>Use String.Empty to fire this event on every CAPS event</remarks>
 /// <param name="capsEvent">Capability event name to register the 
 /// handler for</param>
 /// <param name="eventHandler">Callback to fire</param>
 public void RegisterEvent(string capsEvent, Capabilities.EventQueueCallback eventHandler)
 {
     lock (_EventTable)
     {
         if (_EventTable.ContainsKey(capsEvent))
             _EventTable[capsEvent] += eventHandler;
         else
             _EventTable[capsEvent] = eventHandler;
     }
 }