public EnigmaSettings(IRotor etw, List <IRotor> rotors, IPlugboard plugboard, List <int> rotorPositions) { EntryWheel = etw; Rotors = rotors; PlugBoard = plugboard; RotorPositions = rotorPositions; }
public void ChangeRotor(RotorType type) { var position = _rotor.PositionShift; _rotor = _componentFactory.CreateRotor(type, _slot, position); _settingsAggregator.PublishOnUIThread(_rotor); }
public ScramblerUnitBase(IRotor entryWheel, IReflector reflector, IRotor[] rotors, int[] rotorPositions) { this.Rotors = rotors; this.RotorPositions = rotorPositions; this.Reflector = reflector; this.EntryWheel = entryWheel; }
public void TestRotorIMapping() { IRotor reflector = Constants.Rotors.I; Assert.AreEqual <string>("E", reflector.Mapping.Single(r => r.InputCharacter == "A").OutputCharacter); Assert.AreEqual <string>("K", reflector.Mapping.Single(r => r.InputCharacter == "B").OutputCharacter); Assert.AreEqual <string>("M", reflector.Mapping.Single(r => r.InputCharacter == "C").OutputCharacter); Assert.AreEqual <string>("F", reflector.Mapping.Single(r => r.InputCharacter == "D").OutputCharacter); Assert.AreEqual <string>("L", reflector.Mapping.Single(r => r.InputCharacter == "E").OutputCharacter); Assert.AreEqual <string>("G", reflector.Mapping.Single(r => r.InputCharacter == "F").OutputCharacter); Assert.AreEqual <string>("D", reflector.Mapping.Single(r => r.InputCharacter == "G").OutputCharacter); Assert.AreEqual <string>("Q", reflector.Mapping.Single(r => r.InputCharacter == "H").OutputCharacter); Assert.AreEqual <string>("V", reflector.Mapping.Single(r => r.InputCharacter == "I").OutputCharacter); Assert.AreEqual <string>("Z", reflector.Mapping.Single(r => r.InputCharacter == "J").OutputCharacter); Assert.AreEqual <string>("N", reflector.Mapping.Single(r => r.InputCharacter == "K").OutputCharacter); Assert.AreEqual <string>("T", reflector.Mapping.Single(r => r.InputCharacter == "L").OutputCharacter); Assert.AreEqual <string>("O", reflector.Mapping.Single(r => r.InputCharacter == "M").OutputCharacter); Assert.AreEqual <string>("W", reflector.Mapping.Single(r => r.InputCharacter == "N").OutputCharacter); Assert.AreEqual <string>("Y", reflector.Mapping.Single(r => r.InputCharacter == "O").OutputCharacter); Assert.AreEqual <string>("H", reflector.Mapping.Single(r => r.InputCharacter == "P").OutputCharacter); Assert.AreEqual <string>("X", reflector.Mapping.Single(r => r.InputCharacter == "Q").OutputCharacter); Assert.AreEqual <string>("U", reflector.Mapping.Single(r => r.InputCharacter == "R").OutputCharacter); Assert.AreEqual <string>("S", reflector.Mapping.Single(r => r.InputCharacter == "S").OutputCharacter); Assert.AreEqual <string>("P", reflector.Mapping.Single(r => r.InputCharacter == "T").OutputCharacter); Assert.AreEqual <string>("A", reflector.Mapping.Single(r => r.InputCharacter == "U").OutputCharacter); Assert.AreEqual <string>("I", reflector.Mapping.Single(r => r.InputCharacter == "V").OutputCharacter); Assert.AreEqual <string>("B", reflector.Mapping.Single(r => r.InputCharacter == "W").OutputCharacter); Assert.AreEqual <string>("R", reflector.Mapping.Single(r => r.InputCharacter == "X").OutputCharacter); Assert.AreEqual <string>("C", reflector.Mapping.Single(r => r.InputCharacter == "Y").OutputCharacter); Assert.AreEqual <string>("J", reflector.Mapping.Single(r => r.InputCharacter == "Z").OutputCharacter); }
public RotorSettingsController(IEventAggregator settingsAggregator, IComponentFactory componentFactory, IEnigmaSettings enigmaSettings, RotorSlot slot) { _settingsAggregator = settingsAggregator; _componentFactory = componentFactory; _enigmaSettings = enigmaSettings; _slot = slot; _rotor = _enigmaSettings.GetRotor(slot); }
public EnigmaMachine(IAlphabet alphabet, IRotor leftRotor, IRotor centerRotor, IRotor righRotor, IReflector reflector) { _alphabet = alphabet; _leftRotor = leftRotor; _centerRotor = centerRotor; _rightRotor = righRotor; _reflector = reflector; }
public EnigmaI() { _entryWheel = new EntryWheel(); _plugBoard = new PlugBoard(); _fastRotor = new RotorI(); _middleRotor = new RotorII(); _slowRotor = new RotorIII(); _reflector = new ReflectorB(); }
public void LoadSettings(SavedSettings settings) { Rotor1 = ComponentFactory.CreateRotor(settings.Slot1.RotorType, RotorSlot.One, settings.Slot1.Position); Rotor2 = ComponentFactory.CreateRotor(settings.Slot2.RotorType, RotorSlot.Two, settings.Slot2.Position); Rotor3 = ComponentFactory.CreateRotor(settings.Slot3.RotorType, RotorSlot.Three, settings.Slot3.Position); Reflector = ComponentFactory.CreateReflector(settings.ReflectorType); Plugboard = ComponentFactory.CreatePlugboard(settings.PlugboardConnections); InitializeComponentList(); }
public EnigmaI(IRotor slowRotor, IRotor middleRotor, IRotor fastRotor, IReflector reflector) { _entryWheel = new EntryWheel(); _plugBoard = new PlugBoard(); _slowRotor = slowRotor; _middleRotor = middleRotor; _fastRotor = fastRotor; _reflector = reflector; }
public void TestSetRingstellungTo2onRotorI() { IRotor rotorUnderTest = Constants.Rotors.I; rotorUnderTest.Ringstellung = Constants.Alpha.A; var mapping = rotorUnderTest.Mapping.Single(r => r.InputCharacter == "X"); Assert.AreEqual <string>("R", mapping.OutputCharacter); rotorUnderTest.Ringstellung = Constants.Alpha.B; mapping = rotorUnderTest.Mapping.Single(r => r.InputPin == 1); Assert.AreEqual <string>("J", mapping.OutputCharacter); rotorUnderTest.Ringstellung = Constants.Alpha.F; mapping = rotorUnderTest.Mapping.Single(r => r.InputPin == 1); Assert.AreEqual <string>("I", mapping.OutputCharacter); }
public void Work(IRotor transport) { transport.Rotation(); }