Ejemplo n.º 1
0
        public async Task Tournaments()
        {
            var response = await _crest.GetRoot().QueryAsync(r => r.Tournaments);

            var tournament = _crest.Load(response.Items.Single(r => r.Id == 14));
            var match      = _crest.Load(tournament.Series).Query(r => r.Items.First().Matches).Items.First();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Queries a collection of resources.
        /// </summary>
        /// <typeparam name="TOut">The type of the t out.</typeparam>
        /// <param name="objFunc">The object function.</param>
        /// <returns>Task&lt;TOut[]&gt;.</returns>
        public virtual IEnumerable <TOut> Query <TOut>(Func <T, IEnumerable <ILinkedEntity <TOut> > > objFunc)
            where TOut : class, ICrestResource <TOut>
        {
            IEnumerable <ILinkedEntity <TOut> > items = objFunc.Invoke(this as T);

            return(EveCrest.Load(items));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Queries a collection of resources.
        /// </summary>
        /// <typeparam name="TOut">The type of the t out.</typeparam>
        /// <param name="objFunc">The object function.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>Task&lt;TOut[]&gt;.</returns>
        public virtual IEnumerable <TOut> Query <TOut>(Func <T, IEnumerable <ILinkedEntity <TOut> > > objFunc, params string[] parameters)
            where TOut : class, ICrestResource <TOut>
        {
            var items = objFunc.Invoke(this as T);

            return(EveCrest.Load(items, parameters));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns an enumerator that iterates through a collection.
        /// </summary>
        /// <returns>An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the collection.</returns>
        IEnumerator IEnumerable.GetEnumerator()
        {
            foreach (var item in Items)
            {
                yield return(item);
            }
            if (Next == null || !EveCrest.EnableAutomaticPaging)
            {
                yield break;
            }
            if (NextResource == null)
            {
                NextResource = EveCrest.Load(Next);
            }
            var iter = NextResource.GetEnumerator();

            while (iter.MoveNext())
            {
                yield return(iter.Current);
            }
        }
Ejemplo n.º 5
0
        public static void Main(string[] args)
        {
            // There are alternate views for things requiring a preamble.
            var crest = new EveCrest();
            var root = crest.GetRoot();

            // Note collections hold only the first 1000 or so items. To get an enumerable
            // over all, one might use the AllItems utility method.

            // The following is an illustration of one way to get the region ID for a given
            // named region.
            var regions = root.Query(r => r.Regions);
            const string regionName = "Deklein";
            var regionId = regions.AllItems().First(r => r.Name == regionName).Id;
            Console.WriteLine("Id for region '{0}' is {1}", regionName, regionId);

            // Now get the market type ID for generic small antimatter.
            var marketTypes = crest.Load(root.MarketTypes);
            const string itemName = "Antimatter Charge S";
            var itemId = marketTypes.AllItems().Select(i => i.Type).First(t => t.Name == itemName).Id;
            Console.WriteLine("Id for market item '{0}' is {1}", itemName, itemId);

            // The following call is deprecated as it is not idiomatic w.r.t. CREST, but it's
            // unclear to me what its replacement actually is.
            var hist = crest.GetMarketHistory(regionId, itemId);
            double monies = 0;
            long items = 0;
            foreach (var item in hist.AllItems())
            {
                monies += item.AvgPrice * item.Volume;
                items += item.Volume;
            }
            // These reports seem to span 13 total months.
            Console.WriteLine("Avg for '{0}' in '{1}' is {2} across {3} total ISK volume", itemName, regionName, monies / items, monies);

            // That's actually rather more than I expected. Who finds it effective to brawl with
            // antimatter charge S in nullsec, against the NPCs we often see here?
        }
Ejemplo n.º 6
0
 /// <summary>
 ///     Queries the resource.
 /// </summary>
 /// <typeparam name="TOut">The type of the t out.</typeparam>
 /// <param name="objFunc">The object function.</param>
 /// <returns>Task&lt;TOut&gt;.</returns>
 public virtual TOut Query <TOut>(Func <T, Href <TOut> > objFunc)
     where TOut : class, ICrestResource <TOut>
 {
     return(EveCrest.Load(objFunc.Invoke(this as T)));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Queries the resource.
 /// </summary>
 /// <typeparam name="TOut">The type of the t out.</typeparam>
 /// <param name="objFunc">The object function.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>Task&lt;TOut&gt;.</returns>
 public virtual TOut Query <TOut>(Func <T, Href <TOut> > objFunc, params string[] parameters)
     where TOut : class, ICrestResource <TOut>
 {
     return(EveCrest.Load(objFunc.Invoke(this as T), parameters));
 }