Example #1
0
        public override async Task PublishMessageAsync(IMessage message, CancellationToken cancellationToken)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            // Only process messages for which there are defined exchanges.
            Type messageType = message.GetType();

            if (!PublisherModule.IsExchangeMessage(messageType))
            {
                return;
            }

            // Lookup the exchange associated with the message and the bus
            // on which it should be created.
            ExchangeMeta definition = PublisherModule.GetDefinition(messageType);
            IBus         bus        = BusModule.GetBus(definition.BusName);

            // Create the exchange/queue:
            CreatedExchange createdExchange = await CreateExchange(bus, definition).ConfigureAwait(false);

            LogPublishedMessage(createdExchange, message);

            // Publish the message to the created exchange/queue.
            await definition.PublisherStrategy.Publish(this, createdExchange,
                                                       message,
                                                       cancellationToken);
        }
Example #2
0
    public void InstructionRegisterReset()
    {
        for (int i = 0; i < gameObjBits.Length; i++)
        {
            gameObjBits[i] = gameObject.transform.GetChild(i).gameObject;
            gameObjBits[i].GetComponent <Renderer>().material.SetColor("_Color", Color.white);
        }

        busModule = GameObject.Find("Bus").GetComponent <BusModule>();
        busBits   = busModule.busBits;
    }
Example #3
0
    public void ALUReset()
    {
        // Get all child objects (bits) for our ALU
        for (int i = 0; i < gameObjBits.Length; i++)
        {
            gameObjBits[i] = gameObject.transform.GetChild(i).gameObject; // Bit7 = [0] ... Bit0 = [7]
            gameObjBits[i].GetComponent <Renderer>().material.SetColor("_Color", Color.white);
        }

        busModule    = GameObject.Find("Bus").GetComponent <BusModule>();
        externalFunc = GameObject.Find("ExternalFuncs").GetComponent <ExternalFuncs>();
    }
    void Start()
    {
        RAM = GameObject.Find("RAM").GetComponent <RAMModule>();
        IR  = GameObject.Find("Instruction Register").GetComponent <InstructionRegisterModule>();
        ALU = GameObject.Find("ALU").GetComponent <ALUModule>();
        PC  = GameObject.Find("Program Counter").GetComponent <ProgramCounterModule>();
        BUS = GameObject.Find("Bus").GetComponent <BusModule>();

        A = GameObject.Find("Register_A").GetComponent <RegisterModule>();
        B = GameObject.Find("Register_B").GetComponent <RegisterModule>();
        O = GameObject.Find("Output Register").GetComponent <RegisterModule>();

        externalFunc = GameObject.Find("ExternalFuncs").GetComponent <ExternalFuncs>();
        assembler    = GameObject.Find("Assembler").GetComponent <Assembler>();
    }
Example #5
0
    public void ProgramCounterReset()
    {
        busModule    = GameObject.Find("Bus").GetComponent <BusModule>();
        externalFunc = GameObject.Find("ExternalFuncs").GetComponent <ExternalFuncs>();

        for (int i = 0; i < pcBits.Length; i++)
        {
            pcBits[i] = 0;
        }

        for (int i = 0; i < pcBitGameObj.Length; i++)
        {
            pcBitGameObj[i] = gameObject.transform.GetChild(i).gameObject;
            pcBitGameObj[i].GetComponent <Renderer>().material.SetColor("_Color", Color.white);
        }

        bits = 0;
    }
Example #6
0
    public void RAMReset()
    {
        for (int i = 0; i < 16; i++)
        {
            reg[i] = new int[8];
        }

        for (int i = 0; i < fourDipBits.Length; i++)
        {
            fourDipBits[i] = gameObject.transform.GetChild(i).gameObject;
            fourDipBits[i].GetComponent <Renderer>().material.SetColor("_Color", Color.white);
        }

        for (int i = 0; i < ramBits.Length; i++)
        {
            ramBits[i] = gameObject.transform.GetChild(i + 4).gameObject;
            ramBits[i].GetComponent <Renderer>().material.SetColor("_Color", Color.white);
        }


        busModule    = GameObject.Find("Bus").GetComponent <BusModule>();
        externalFunc = GameObject.Find("ExternalFuncs").GetComponent <ExternalFuncs>();
    }