コード例 #1
0
        public void Main(string argument)
        {
            //First ensure the system is able to process commands
            //-if necessary, perform first time setup
            //-if necessary or requested, initialise the system
            if (!initialised || argument == command_Initialise)
            {
                //if we cannot initialise, end here
                if (!Initialise())
                {
                    return;
                }
            }
            else if (!Validate())
            {
                //if saved state is not valid, try re-initialising
                //if we cannot initialise, end here
                if (!Initialise())
                {
                    return;
                }
            }

            //Check that the argument is not a command for us
            if (argument == command_Initialise)
            {
                return;
            }

            //Otherwise send argument as command to drive controller
            //-write command to the command bus
            if (argument.Length > CommandBus.lengthId)
            {
                Echo("ERROR: bus id too long \"" + argument + "\"");
            }
            else
            {
                busCommand.AppendTemporaryString(CommandBus.ExtendId(argument), "");
                Echo("Command Bus updated: " + argument);
            }
        }