public override int GetHashCode() { unchecked { int result = 7411; result = (result * 733) ^ RotorName.GetHashCode(); result = (result * 733) ^ AlphabetRingPosition; result = (result * 733) ^ NotchRingName.GetHashCode(); result = (result * 733) ^ NotchRingPosition; return(result); } }
public static NotchRingName?GetNotchRingNameFromString(this string s) { NotchRingName result = NotchRingName.NotchRing1; if (s.Contains("NotchRing")) { if (Enum.TryParse <NotchRingName>(s, out result)) { return(result); } } string check = string.Join("NotchRing{0}", s); if (Enum.TryParse <NotchRingName>(check, out result)) { return(result); } return(null); }
public override string ToString() { return(string.Format("{0} {1} {2} {3}", RotorName.GetRotorName(), AlphabetRingPosition, NotchRingName.GetNotchRingName(), Rotor.PositionToSetting(NotchRingPosition))); }
public static string GetNotchRingName(this NotchRingName source) { return(string.Concat(source.ToString().Where(c => Char.IsNumber(c)))); }