Ejemplo n.º 1
0
        // Constructors
        #region Constructors
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="difficulty"></param>
        public DifficultyOption(Types.Difficulty difficulty)
        {
            switch (difficulty)
            {
            // Setting the display name for the Casual difficulty
            case Types.Difficulty.Casual:
                this.DifficultyDisplayName = Properties.Resources.Difficulty_Casual;
                break;

            // Setting the display name for the Casual difficulty
            case Types.Difficulty.Normal:
                this.DifficultyDisplayName = Properties.Resources.Difficulty_Normal;
                break;

            // Setting the display name for the Casual difficulty
            case Types.Difficulty.Hard:
                this.DifficultyDisplayName = Properties.Resources.Difficulty_Hard;
                break;

            // Setting the display name for the Casual difficulty
            case Types.Difficulty.Tournament:
                this.DifficultyDisplayName = Properties.Resources.Difficulty_Tournament;
                break;

            // Setting the display name for the Casual difficulty
            case Types.Difficulty.Open:
                this.DifficultyDisplayName = Properties.Resources.Difficulty_Open;
                break;

            // Setting the display name for the Casual difficulty
            case Types.Difficulty.Full:
                this.DifficultyDisplayName = Properties.Resources.Difficulty_Full;
                break;

            // Throw error in case of difficulty not recognized
            default: throw new NotSupportedException(difficulty.ToString());
            }

            // Set the difficulty level
            this.Difficulty = difficulty;
        }
        /// <summary>
        /// Composes the new file name of the newly randomized ROM
        /// </summary>
        /// <param name="seed">Seed number</param>
        /// <param name="difficulty">Difficulty of the seed</param>
        /// <param name="sourcefilename">Source file name</param>
        /// <returns></returns>
        private string ComposeFileName(int seed, Types.Difficulty difficulty, string sourcefilename)
        {
            // Gets the extension
            string extension = Path.GetExtension(sourcefilename);

            // Composes the filename based on the seed and difficulty
            switch (difficulty)
            {
            // Setting the file name for the Casual difficulty
            case Types.Difficulty.Casual:
                return("CX" + seed.ToString() + extension);

            // Setting the file name for the Casual difficulty
            case Types.Difficulty.Normal:
                return("X" + seed.ToString() + extension);

            // Setting the file name for the Casual difficulty
            case Types.Difficulty.Hard:
                return("HX" + seed.ToString() + extension);

            // Setting the file name for the Casual difficulty
            case Types.Difficulty.Tournament:
                return("TX" + seed.ToString() + extension);

            // Setting the file name for the Casual difficulty
            case Types.Difficulty.Open:
                return("OX" + seed.ToString() + extension);

            // Setting the file name for the Casual difficulty
            case Types.Difficulty.Full:
                return("FX" + seed.ToString() + extension);

            // Throw error in case of difficulty not recognized
            default: throw new NotSupportedException(difficulty.ToString());
            }
        }