public EnigmaService(DiscordBotServiceContainer services,
                      ConfigParserService configParser) : base(services)
 {
     letterSet             = LetterSetIO.Read(LetterSetFile);
     steckering            = PlugboardIO.Read(letterSet.Count, PlugboardFile);
     rotorKeys             = RotorIO.Read(RotorKeysFile);
     this.configParser     = configParser;
     Client.ReactionAdded += OnReactionAddedAsync;
 }
 /// <summary>
 /// Runs the plugboard randomizer.
 /// </summary>
 ///
 /// <exception cref="SaveFailedException">
 /// Failed to save the new plugboard steckering.
 /// </exception>
 public void RandomizePlugboard(LetterSet letterSet)
 {
     if (letterSet == null)
     {
         throw new LetterSetMissingException("Cannot configure Plugboard without a loaded letterset!");
     }
     try {
         Steckering newSteckering = PlugboardIO.Generate(letterSet.Count);
         SaveToFile(newSteckering, File);
         Steckering = newSteckering;
     }
     catch (Exception ex) {
         throw new SaveFailedException(ex);
     }
 }
 /// <summary>
 /// Writes the input plugboard steckering to the file.
 /// </summary>
 /// <param name="steckering">The new steckering to save.</param>
 /// <param name="plugboardFile">The plugboard file to save the steckering to.</param>
 private void SaveToFile(Steckering steckering, string plugboardFile)
 {
     Directory.CreateDirectory(Path.GetDirectoryName(plugboardFile));
     PlugboardIO.Write(steckering, plugboardFile);
 }
 /// <summary>
 /// Reads the file and returns the <see cref="int[]"/> plugboard steckering.
 /// </summary>
 /// <param name="letterSet">The letterset to reference the index of the characters.</param>
 /// <param name="plugboardFile">The file containing the plugboard setup.</param>
 ///
 /// <exception cref="Exception">
 /// A file has invalid formatting, a parsed letter was invalid, or mismatched characters.
 /// </exception>
 private void LoadFromFile(LetterSet letterSet, string plugboardFile)
 {
     Steckering = PlugboardIO.Read(letterSet.Count, plugboardFile);
 }