Ejemplo n.º 1
0
        public static MonthlySettings Random(int year, int month, MachineType t)
        {
            MonthlySettings result = new MonthlySettings();

            result.Month = month;
            result.Year  = year;

            for (int i = DateTime.DaysInMonth(year, month); i > 0; i--)
            {
                Settings s = Settings.Random(t);
                s.Day = i;
                result.DailySettings.Add(s);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public static MonthlySettings Random(int year, int month, MachineType t, ReflectorType r, bool compatibilityMode = false)
        {
            MonthlySettings result = new MonthlySettings();

            result.Month = month;
            result.Year  = year;

            for (int i = DateTime.DaysInMonth(year, month); i > 0; i--)
            {
                Settings s = Settings.Random(t);
                s.Day = i;
                result.DailySettings.Add(s);
            }

            foreach (var item in result.DailySettings)
            {
                item.ReflectorType = r;
                if (t == MachineType.M4K)
                {
                    if (r == ReflectorType.B_Dunn)
                    {
                        item.Rotors[0].Name = RotorName.Beta;
                        if (compatibilityMode)
                        {
                            item.Rotors[0].RingSetting = 0;
                        }
                    }
                    else
                    {
                        item.Rotors[0].Name = RotorName.Gamma;
                        if (compatibilityMode)
                        {
                            item.Rotors[0].RingSetting = 0;
                        }
                    }
                }
            }

            return(result);
        }