コード例 #1
0
        /// <summary>
        /// Converts a URL into a ConverterDeck which has all ConverterMappings populated with potential cards from the ConverterGame
        /// </summary>
        /// <param name="url">The URL of the Deck</param>
        /// <param name="converterGame">The ConverterGame instance that will be used for searching for matches</param>
        /// <returns>A ConverterDeck which has all ConverterMappings populated with potential OCTGN cards from the converterSets</returns>
        public ConverterDeck ConvertURL(string url, ConverterGame converterGame)
        {
            Logger.Info("Converting the url " + url + " to the game " + converterGame.Game.Name);

            // Try to find a pre-defined GameConverter to handle ConvertFile
            Game.GameConverter gameConverter = this.FindMatchingGameConverter(converterGame);

            if (gameConverter != null)
            {
                return(gameConverter.ConvertURL(url, converterGame));
            }

            throw new NotImplementedException("Converting a URL for game " + converterGame.Game.Name + " has not been implemented yet.");
        }
コード例 #2
0
        /// <summary>
        /// Converts user input text into a ConverterDeck which has all ConverterMappings populated with potential cards from the ConverterGame
        /// </summary>
        /// <param name="sectionsText">A collection of section names (keys), and the user input text of all cards in the section (values)</param>
        /// <param name="converterGame">The ConverterGame instance that will be used for searching for matches</param>
        /// <returns>A ConverterDeck which has all ConverterMappings populated with potential OCTGN cards from the converterSets</returns>
        public ConverterDeck ConvertText(Dictionary <string, string> sectionsText, ConverterGame converterGame)
        {
            Logger.Info("Converting text to the game " + converterGame.Game.Name);

            // Try to find a pre-defined GameConverter to handle ConvertText
            Game.GameConverter gameConverter = this.FindMatchingGameConverter(converterGame);

            if (gameConverter != null)
            {
                return(gameConverter.ConvertText(sectionsText, converterGame));
            }
            else
            {
                return(TextConverter.ConvertText(sectionsText, converterGame.Sets, converterGame.DeckSectionNames));
            }
        }