Ejemplo n.º 1
0
 public RotorViewModelFactory(IEventAggregator enigmaAggregator, IComponentFactory componentFactory, IEnigmaSettings enigmaSettings, HelpersViewModelFactory helpersViewModelFactory)
 {
     _enigmaAggregator        = enigmaAggregator;
     _componentFactory        = componentFactory;
     _enigmaSettings          = enigmaSettings;
     _helpersViewModelFactory = helpersViewModelFactory;
 }
Ejemplo n.º 2
0
            public ReflectorController(IEnigmaSettings enigmaSettings, IComponentFactory componentFactory, IEventAggregator settingsAggregator)
            {
                _enigmaSettings     = enigmaSettings;
                _componentFactory   = componentFactory;
                _settingsAggregator = settingsAggregator;

                _reflector = _enigmaSettings.Reflector;
            }
Ejemplo n.º 3
0
 public RotorSettingsController(IEventAggregator settingsAggregator, IComponentFactory componentFactory, IEnigmaSettings enigmaSettings, RotorSlot slot)
 {
     _settingsAggregator = settingsAggregator;
     _componentFactory   = componentFactory;
     _enigmaSettings     = enigmaSettings;
     _slot  = slot;
     _rotor = _enigmaSettings.GetRotor(slot);
 }
Ejemplo n.º 4
0
 public PlugboardViewModel(ConnectingAlphabetViewModel topAlphabet, ConnectingAlphabetViewModel bottomAlphabet, ConnectingViewModelFactory factory,
                           IEventAggregator viewEventAggregator, IEnigmaSettings enigmaSettings)
 {
     TopAlphabet          = topAlphabet;
     BottomAlphabet       = bottomAlphabet;
     _factory             = factory;
     _enigmaSettings      = enigmaSettings;
     _plugboardController = new PlugboardController(enigmaSettings);
     viewEventAggregator.Subscribe(this);
 }
Ejemplo n.º 5
0
        private static IEnigmaSettings GetSettingsIv(IEnigmaSettings settings, byte[] iv)
        {
            string ivString = iv != null?Encoding.Unicode.GetString(iv) : string.Empty;

            IDictionary <EnigmaRotorPosition, char> rotorSettings = ParseEnigmaRotorSettings(ivString);

            settings.Rotors[EnigmaRotorPosition.Fastest].CurrentSetting = rotorSettings[EnigmaRotorPosition.Fastest];
            settings.Rotors[EnigmaRotorPosition.Second].CurrentSetting  = rotorSettings[EnigmaRotorPosition.Second];
            settings.Rotors[EnigmaRotorPosition.Third].CurrentSetting   = rotorSettings[EnigmaRotorPosition.Third];

            return(settings);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Enigma"/> class.
 /// </summary>
 /// <param name="settings">The cipher's settings.</param>
 public Enigma(IEnigmaSettings settings) => Settings = settings;
Ejemplo n.º 7
0
        public ReflectorViewModel(IEventAggregator enigmaAggregator, IComponentFactory componentFactory, IEnigmaSettings enigmaSettings, HelpersViewModelFactory helpersViewModelFactory)
        {
            Types = Enum.GetValues(typeof(ReflectorType)).Cast <ReflectorType>();

            _componentController = new ReflectorController(enigmaSettings, componentFactory, enigmaAggregator);

            var reflectorAggregator = _componentController.GetAggregator();

            ReflectorType = _componentController.GetComponentType();

            _viewController = new ReflectorViewController(reflectorAggregator, helpersViewModelFactory);

            AlphabetViewModel = _viewController.GetAlphabetViewModel();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EnigmaRotorSettingViewModel"/> class.
 /// </summary>
 /// <param name="settings">The enigma settings.</param>
 public EnigmaRotorSettingViewModel(IEnigmaSettings settings) => _settings = settings;
 /// <summary>
 /// Initializes a new instance of the <see cref="EnigmaRingPositionViewModel"/> class.
 /// </summary>
 /// <param name="settings">The enigma settings.</param>
 public EnigmaRingPositionViewModel(IEnigmaSettings settings) => _settings = settings;
Ejemplo n.º 10
0
        public RotorViewModel(IEventAggregator settingsAggregator, IComponentFactory componentFactory, RotorSlot slot, IEnigmaSettings enigmaSettings, HelpersViewModelFactory helpersViewModelFactory)
        {
            RotorTypes           = Enum.GetValues(typeof(RotorType)).Cast <RotorType>();
            _componentController = new RotorSettingsController(settingsAggregator, componentFactory, enigmaSettings, slot);

            var componentAggregator = _componentController.GetAggregator();
            var connections         = _componentController.GetConnections();
            var positionShift       = _componentController.GetPositionShift();

            RotorType = _componentController.GetRotorType();

            _viewController   = new RotorViewController(componentAggregator, helpersViewModelFactory, connections, positionShift);
            AlphabetViewModel = _viewController.GetAlphabetView();
        }
Ejemplo n.º 11
0
 public PlugboardController(IEnigmaSettings enigmaSettings)
 {
     _enigmaSettings = enigmaSettings;
     _plugboard      = _enigmaSettings.Plugboard;
 }
Ejemplo n.º 12
0
 public Enigma(IEnigmaSettings enigmaSettings, IUtilityFactory utilityFactory)
 {
     _enigmaSettings = enigmaSettings;
     _utilityFactory = utilityFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EnigmaRotorNumberViewModel"/> class.
 /// </summary>
 /// <param name="settings">The enigma settings.</param>
 public EnigmaRotorNumberViewModel(IEnigmaSettings settings) => _settings = settings;