예제 #1
0
 public BuildConverter(
     IAscendancyClasses ascendancyClasses,
     Func <string, BuildUrlDeserializer> factory,
     params TryCreateDeserializer[] deserializersFactories)
 {
     _ascendancyClasses      = ascendancyClasses;
     _deserializersFactories = new HashSet <TryCreateDeserializer>(deserializersFactories);
     _factory = factory;
 }
예제 #2
0
        /// <summary>
        /// Creates the <see cref="PathofexileUrlDeserializer"/> class instance if specified url is valid.
        /// </summary>
        /// <param name="buildUrl">The string containing a build url.</param>
        /// <param name="deserializer">When this method returns, contains the deserializer instance or null, if url conversion is impossible.</param>
        /// <returns>true if deserializer was created successfully; otherwise, false.</returns>
        public static bool TryCreate(string buildUrl, IAscendancyClasses ascendancyClasses, out BuildUrlDeserializer deserializer)
        {
            if (!UrlRegex.IsMatch(buildUrl))
            {
                deserializer = null;
                return(false);
            }

            deserializer = new PathofexileUrlDeserializer(buildUrl, ascendancyClasses);
            return(true);
        }
예제 #3
0
        /// <summary>
        /// Creates the <see cref="PoeplannerUrlDeserializer"/> class instance if specified url is valid.
        /// </summary>
        /// <param name="buildUrl">A string containing a build url.</param>
        /// <param name="deserializer">When this method returns, contains the deserializer instance or null, if url conversion is impossible.</param>
        /// <returns>true if deserializer was created successfully; otherwise, false.</returns>
        public static bool TryCreate(
            string buildUrl, IAscendancyClasses ascendancyClasses,
            [NotNullWhen(true)] out BuildUrlDeserializer?deserializer)
        {
            if (!UrlRegex.IsMatch(buildUrl))
            {
                deserializer = null;
                return(false);
            }

            deserializer = new PoeplannerUrlDeserializer(buildUrl, ascendancyClasses);
            return(true);
        }
        private IEnumerable <ClassFilterItem> GenerateAscendancyClassItems(IAscendancyClasses ascendancyClasses)
        {
            yield return(NoFilterItem);

            foreach (var characterClass in Enums.GetValues <CharacterClass>())
            {
                var charClass = characterClass.ToString();
                yield return(new ClassFilterItem(charClass, null));

                foreach (var ascClass in ascendancyClasses.AscendancyClassesForCharacter(characterClass))
                {
                    yield return(new ClassFilterItem(charClass, ascClass));
                }
            }
        }
예제 #5
0
        private IEnumerable <ClassFilterItem> GenerateAscendancyClassItems(IAscendancyClasses ascendancyClasses)
        {
            yield return(NoFilterItem);

            foreach (var nameToContent in CharacterNames.NameToContent)
            {
                var charClass = nameToContent.Value;
                yield return(new ClassFilterItem(charClass, null));

                foreach (var ascClass in ascendancyClasses.AscendancyClassesForCharacter(charClass))
                {
                    yield return(new ClassFilterItem(charClass, ascClass));
                }
            }
        }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BuildUrlDeserializer"/> class.
 /// </summary>
 /// <param name="buildUrl">The PoE build url.</param>
 /// <param name="ascendancyClasses">The instance of the <see cref="ascendancyClasses"/>
 /// to access general information about skill tree.</param>
 protected BuildUrlDeserializer(string buildUrl, IAscendancyClasses ascendancyClasses)
 {
     BuildUrl           = buildUrl ?? string.Empty;
     _ascendancyClasses = ascendancyClasses;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PathofexileUrlDeserializer"/> class disregarding the specified url format.
 /// </summary>
 /// <param name="buildUrl">The https://pathofexile.com build url.</param>
 /// <param name="ascendancyClasses">The instance of the <see cref="ascendancyClasses"/>
 /// to access general information about skill tree.</param>
 private PathofexileUrlDeserializer(string buildUrl, IAscendancyClasses ascendancyClasses) : base(buildUrl, ascendancyClasses)
 {
 }
예제 #8
0
 public BuildConverter(IAscendancyClasses ascendancyClasses)
 {
     _ascendancyClasses = ascendancyClasses;
 }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PoeplannerUrlDeserializer"/> class.
 /// </summary>
 /// <param name="buildUrl">The poeplanner build url.</param>
 /// <param name="ascendancyClasses">The instance of the <see cref="ascendancyClasses"/>
 /// to access general information about skill tree.</param>
 private PoeplannerUrlDeserializer(string buildUrl, IAscendancyClasses ascendancyClasses) : base(buildUrl, ascendancyClasses)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NaivePoEUrlDeserializer"/> class.
 /// </summary>
 /// <param name="buildUrl">The PoE build url.</param>
 /// <param name="ascendancyClasses">The instance of the <see cref="ascendancyClasses"/>
 /// to access general information about skill tree.</param>
 public NaivePoEUrlDeserializer(string buildUrl, IAscendancyClasses ascendancyClasses) : base(buildUrl, ascendancyClasses)
 {
 }