mirror of
https://github.com/vanitasvitae/EnigmAndroid.git
synced 2024-11-22 04:12:06 +01:00
Fix #4; Catch non-alphabetic input in the plugboard.
This commit is contained in:
parent
449c80ebd5
commit
965aee43dd
3 changed files with 14 additions and 6 deletions
|
@ -8,8 +8,8 @@ android {
|
|||
applicationId "de.vanitasvitae.enigmandroid"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 21
|
||||
versionCode 6
|
||||
versionName "0.1.1-18.02.2015-beta"
|
||||
versionCode 7
|
||||
versionName "0.1.1-23.02.2015-beta"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
|
@ -148,6 +148,7 @@ public class Enigma
|
|||
*/
|
||||
public static char[][] parsePlugs(String p) throws InvalidPlugboardConfigurationFormatException
|
||||
{
|
||||
p = p.toUpperCase();
|
||||
//Check, if empty
|
||||
if (p.length() == 0)
|
||||
{
|
||||
|
@ -176,12 +177,18 @@ public class Enigma
|
|||
}
|
||||
//If it does
|
||||
else
|
||||
{
|
||||
char[] pair = x.toCharArray();
|
||||
//Check, if Plugs are in alphabet
|
||||
if(pair[0]<65 || pair[1]<65 || pair[0]>90 || pair[1]>90) throw new InvalidPlugboardConfigurationFormatException("Error parsing plugs! Maybe you entered a number or a special character?");
|
||||
else
|
||||
{
|
||||
//add it to the array
|
||||
plugs[i] = x.toCharArray();
|
||||
plugs[i] = pair;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return plugs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,10 @@ Features:
|
|||
* Working plugboard
|
||||
|
||||
More Information about the historical Enigma can be found on Wikipedia.org
|
||||
(I recommend the german article, since it is very detailed.)
|
||||
.
|
||||
|
||||
Repo Type: git
|
||||
Build:0.1.1-18.02.2015-beta,6
|
||||
Build:0.1.1-23.02.2015-beta,7
|
||||
Auto Update Mode:None
|
||||
Update Check Mode:None
|
||||
|
|
Loading…
Reference in a new issue