예제 #1
0
        private async Task SetEnigmaMachineRotorsConfiguration(string userId)
        {
            var rotorsConfiguration = await enigmaMachineConfigurationPort
                                      .GetEnigmaMachineRotorsConfiguration(userId);

            if (rotorsConfiguration != null)
            {
                enigmaMachine.SetStartupRotorRingLetters(
                    new char[] {
                    rotorsConfiguration.FirstLetter,
                    rotorsConfiguration.SecondLetter,
                    rotorsConfiguration.ThirdLetter
                }
                    );
            }
        }
예제 #2
0
        public async Task <EnigmaMachineRotorsConfigurationModel> GetEnigmaMachineRotorsConfiguration(string userId)
        {
            EnigmaMachineRotorsConfigurationModel model = null;

            try
            {
                var configuration = await enigmaMachineConfigurationPort
                                    .GetEnigmaMachineRotorsConfiguration(userId);

                model = mapper.Map <EnigmaMachineRotorsConfigurationModel>(configuration);
            }
            catch (Exception exception)
            {
                logger.LogError(exception,
                                $"An error has occured while trying to get machine rotors configuation for user id: {userId}");
            }

            return(model);
        }