Exemple #1
0
 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);
     }
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 public override string ToString()
 {
     return(string.Format("{0} {1} {2} {3}", RotorName.GetRotorName(), AlphabetRingPosition, NotchRingName.GetNotchRingName(), Rotor.PositionToSetting(NotchRingPosition)));
 }
Exemple #4
0
 public static string GetNotchRingName(this NotchRingName source)
 {
     return(string.Concat(source.ToString().Where(c => Char.IsNumber(c))));
 }