Beispiel #1
0
        /// <summary>
        ///     Returns loss mails
        /// </summary>
        /// <param name="options">ZKillboard options</param>
        /// <returns>Loss mails</returns>
        public Task <ZkbResponse> GetLossesAsync(ZKillboardOptions options)
        {
            Contract.Requires(options != null, "Options cannot be null");
            string relPath = "/api/losses";

            relPath = options.GetQueryString(relPath);
            return(requestAsync <ZkbResponse>(new Uri(Host, relPath)));
        }
        private void CheckKills()
        {
            ZKillboard kb = new ZKillboard();
            ZKillboardOptions Options = new ZKillboardOptions();
            Options.CorporationId.Add(98389365);
            Options.StartTime = new DateTime(2015, 04, 01);

            ZkbResponse Kills;  // = kb.GetKills(Options);
            ZkbResponse Losses; // = kb.GetLosses(Options);

            string thing = Properties.Settings.Default.TestThis;

            try
            {
                Kills = kb.GetKills(Options);
                Losses = kb.GetLosses(Options);

                foreach (ZkbResponse.ZkbKill Kill in Kills)
                {
                    textBox2.Text = string.Concat(textBox2.Text, "R3MUS KILL at  ", Kill.KillTime.ToString(), Environment.NewLine);
                    textBox2.Text = string.Concat(textBox2.Text, "Victim: ", Kill.Victim.CharacterName, " lost a ", GetProductType(Kill.Victim.ShipTypeId).Name, Environment.NewLine);
                    foreach(ZkbResponse.ZkbAttacker Attacker in Kill.Attackers)
                    {
                        if (Attacker.FinalBlow == "1")
                        {
                            textBox2.Text = string.Concat(textBox2.Text, "Last Blow: ", Attacker.CharacterName, Environment.NewLine);
                        }
                        if (Attacker.CorporationId == 98389365)
                        {
                            textBox2.Text = string.Concat(textBox2.Text, "Wolf ", Attacker.CharacterName, " got on the board in a ", GetProductType(Attacker.ShipTypeId).Name, "!", Environment.NewLine);
                        }
                    }
                    if (Kill.Stats != null)
                    {
                        textBox2.Text = string.Concat(textBox2.Text, "Loss: ", Kill.Stats.TotalValue.ToString(), Environment.NewLine);
                    }
                    else
                    {
                        textBox2.Text = string.Concat(textBox2.Text, "Loss value not obtainable.", Environment.NewLine);
                    }
                }

            }
            catch (Exception ex)
            {
            }
        }
Beispiel #3
0
 /// <summary>
 ///     Returns both Kill and loss mails
 /// </summary>
 /// <param name="options">ZKillboard options</param>
 /// <returns>Kill and loss mails</returns>
 public ZkbResponse GetAll(ZKillboardOptions options) {
     Contract.Requires(options != null, "Options cannot be null");
     return GetAllAsync(options).Result;
 }
Beispiel #4
0
 /// <summary>
 ///     Returns loss mails
 /// </summary>
 /// <param name="options">ZKillboard options</param>
 /// <returns>Loss mails</returns>
 public Task<ZkbResponse> GetLossesAsync(ZKillboardOptions options) {
     Contract.Requires(options != null, "Options cannot be null");
     string relPath = "/api/losses";
     relPath = options.GetQueryString(relPath);
     return requestAsync(new Uri(Host, relPath));
 }
Beispiel #5
0
 /// <summary>
 ///     Returns loss mails
 /// </summary>
 /// <param name="options">ZKillboard options</param>
 /// <returns>Loss mails</returns>
 public ZkbResponse GetLosses(ZKillboardOptions options)
 {
     Contract.Requires(options != null, "Options cannot be null");
     return(GetLossesAsync(options).Result);
 }
        private static KeyValuePair<DateTime, List<ZkbResponse.ZkbKill>> GetZKBResponse(long corpId, DateTime startTime, ZKBType type)
        {
            ZkbResponse Kills;
            ZKillboard kb = new ZKillboard();
            ZKillboardOptions Options = new ZKillboardOptions();
            List<ZkbResponse.ZkbKill> OrderedKills;
            Options.CorporationId.Add(corpId);

            if (startTime > DateTime.MinValue)
            {
                Options.StartTime = startTime;
            }
            if (Properties.Settings.Default.Debug)
            {
                SendPM(string.Format("Using StartTime {0}.", startTime.ToString("yyyy-MM-dd HH:mm:ss")));
            }

            if(type == ZKBType.Kill)
            {
                Kills = kb.GetKills(Options);
            }
            else
            {
                Kills = kb.GetLosses(Options);
            }
            OrderedKills = Kills.OrderBy(Kill => Kill.KillTime).ToList();

            return new KeyValuePair<DateTime, List<ZkbResponse.ZkbKill>>(OrderedKills.Last().KillTime, OrderedKills);
        }