public AutoDoorProgram(IMyGridTerminalSystem grid, IMyProgrammableBlock me, Action <string> echo, TimeSpan elapsedTime)
        {
            GridTerminalSystem = grid;
            Echo        = echo;
            ElapsedTime = elapsedTime;
            Me          = me;

            doors   = new List <IMyDoor>();
            sensors = new List <IMySensorBlock>();

            List <IMyTerminalBlock> blocks = new List <IMyTerminalBlock>();

            grid.SearchBlocksOfName(PREFIX, blocks);

            // Add some error handling for blocks not found

            for (int i = 0; i < blocks.Count; i++)
            {
                IMyTerminalBlock block     = blocks[i];
                String           blockType = block.DefinitionDisplayNameText;
                String           blockName = block.CustomName;

                //Echo("Processing block " + blockName);

                if (blockType.Equals("Sensor"))
                {
                    IMySensorBlock sensor = block as IMySensorBlock;
                    sensor.ApplyAction("OnOff_On");

                    List <ITerminalProperty> properties = new List <ITerminalProperty>();
                    sensor.GetProperties(properties);

                    sensor.SetValueFloat("Back", SensorBack);
                    sensor.SetValueFloat("Bottom", SensorBottom);
                    sensor.SetValueFloat("Top", SensorTop);
                    sensor.SetValueFloat("Left", SensorLeft);
                    sensor.SetValueFloat("Right", SensorRight);
                    sensor.SetValueFloat("Front", SensorFront);
                    sensor.SetValueBool("Detect Asteroids", false);
                    sensor.SetValueBool("Detect Enemy", false);
                    sensor.SetValueBool("Detect Floating Objects", false);
                    sensor.SetValueBool("Detect Friendly", true);
                    sensor.SetValueBool("Detect Large Ships", false);
                    sensor.SetValueBool("Detect Neutral", false);
                    sensor.SetValueBool("Detect Owner", true);
                    sensor.SetValueBool("Detect Players", true);
                    sensor.SetValueBool("Detect Small Ships", false);
                    sensor.SetValueBool("Detect Stations", false);
                    sensor.SetValueBool("Audible Proximity Alert", false);
                    sensors.Add(sensor);
                }
                else if (blockType.Equals("Sliding Door") || blockType.Equals("Door"))
                {
                    IMyDoor door = block as IMyDoor;
                    door.ApplyAction("Open_Off");
                    doors.Add(door);
                }
                else if (blockType.Equals("Rotor") || blockType.Equals("Advanced Rotor"))
                {
                    rotor = block as IMyMotorStator;
                    rotor.ApplyAction("OnOff_On");
                    rotor.SetValueFloat("Torque", 3.36E+07f);
                    rotor.SetValueFloat("BrakingTorque", 3.36E+07f);
                    rotor.SetValueFloat("Velocity", rotorSpeed);
                    rotor.SetValueFloat("UpperLimit", float.PositiveInfinity);
                    rotor.SetValueFloat("LowerLimit", float.NegativeInfinity);

                    // Add config here
                }
            }
        }