/// <summary> /// Runs the rotor keys randomizer. /// </summary> /// /// <exception cref="SaveFailedException"> /// Failed to save the new rotor keys. /// </exception> public void RandomizeRotorKeys(string input) { if (!int.TryParse(input, out int rotorCount)) { throw new FormatException("Input is not a valid integer!"); } if (rotorCount < 1) { throw new ArgumentOutOfRangeException("rotor count", "Input is less than 1!"); } try { RotorKeys newRotorKeys = RotorIO.Generate(rotorCount); SaveToFile(newRotorKeys, File); RotorKeys = newRotorKeys; } catch (Exception ex) { throw new SaveFailedException(ex); } }
public Task RandomKeysAsync(ICommandContext context, int count = 3) { return(context.Channel.SendMessageAsync("{" + string.Join(" ", RotorIO.Generate(count)) + "}")); }