Exemple #1
0
        public static void CreateSwitches(Number number, Engine engine)
        {
            Switches = new List <Logical>();
            var switch0 = PhysicalSwitch.Switch(0);

            switch (number)
            {
            case Number.One:
                Switches.Add(new Logical(switch0, engine));
                break;

            case Number.Two:
                var switch1 = PhysicalSwitch.Switch(1);
                if (Globals.Root.CurrentConfig.ReadBoolean(Config.Reverse_Switches) || Globals.Root.CurrentConfig.ReadBoolean(Config.Use_Swap_Switch))
                {                         // feed switches through the swap logic:
                    Switches.Add(new Logical(new LogicalSwapper(switch0, switch1, engine), engine));
                    Switches.Add(new Logical(new LogicalSwapper(switch1, switch0, engine), engine));
                }
                else
                {
                    Switches.Add(new Logical(switch0, engine));
                    Switches.Add(new Logical(switch1, engine));
                }
                break;

            case Number.ShortLong:
                var rising = new LogicalRising(switch0, engine);
                Switches.Add(rising);
                Switches.Add(new LogicalLong(switch0, rising, engine));
                break;

            case Number.DwellOnly:
                Switches.Add(new LogicalDwell(switch0, engine));
                break;

            case Number.PassThrough:
                Switches.Add(new LogicalPassThrough(switch0, engine));
                break;

            default:
                throw (new ArgumentException("Logical.SetSwitches: invalid number"));
            }
        }
Exemple #2
0
        private LogicalRising ShortSwitch;         // the switch doing the short part; we need a reference to this, to tell it to ignore the rising edge if this one has triggered

        public LogicalLong(ISwitch source, LogicalRising shortLogicSwitch, Engine engine) : base(source, engine)
        {
            ShortSwitch = shortLogicSwitch;
        }