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