// Disconnect the still connected device from the removed device.
    private void OnConnectionRemoved(PoweredUnit removedConnection, IOSocket removedSocket)
    {
        switch (removedSocket.GetSocketType())
        {
        case IOSocket.SocketType.Input:

            if (!this.cableEndA.HasConnection() && this.cableEndB.HasConnection())
            {
                removedConnection.RemoveInput(this.cableEndB.GetConnection());
            }
            else if (!this.cableEndB.HasConnection() && this.cableEndA.HasConnection())
            {
                removedConnection.RemoveInput(this.cableEndA.GetConnection());
            }

            break;

        case IOSocket.SocketType.Output:

            if (!this.cableEndA.HasConnection() && this.cableEndB.HasConnection())
            {
                this.cableEndB.GetConnection().RemoveInput(removedConnection);
            }
            else if (!this.cableEndB.HasConnection() && this.cableEndA.HasConnection())
            {
                this.cableEndA.GetConnection().RemoveInput(removedConnection);
            }

            break;
        }
    }
Example #2
0
    private void OnConnectionMade(PoweredUnit connection, IOSocket connectedSocket)
    {
        this.connection      = connection;
        this.connectedSocket = connectedSocket;

        if (this.connectionMadeCallback != null)
        {
            this.connectionMadeCallback.Invoke();
        }
    }
Example #3
0
 public void SetConnection(PoweredUnit connection, IOSocket connectedSocket)
 {
     if (connection != null && connectedSocket != null)
     {
         this.OnConnectionMade(connection, connectedSocket);
     }
     else
     {
         this.OnConnectionRemoved();
     }
 }
Example #4
0
    private void OnConnectionRemoved()
    {
        /* Temp variables are required as the callback will require
         * the connection to be null and at the same time the original
         * connection (before removal) must be passed into the callback. */
        PoweredUnit tempConnection = this.connection;
        IOSocket    tempSocket     = this.connectedSocket;

        this.connection      = null;
        this.connectedSocket = null;

        if (tempConnection != null && tempSocket != null)
        {
            if (this.connectionRemovedCallback != null)
            {
                this.connectionRemovedCallback.Invoke(tempConnection, tempSocket);
            }
        }
    }
Example #5
0
 public virtual void RemoveOutput(PoweredUnit input)
 {
 }
Example #6
0
 public virtual void AddOutput(PoweredUnit input)
 {
 }
    public override void RemoveInput(PoweredUnit input)
    {
        base.RemoveInput(input);

        this.inputs.Remove(input);
    }
    public override void AddInput(PoweredUnit input)
    {
        base.AddInput(input);

        this.inputs.Add(input);
    }