Пример #1
0
        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)
            {
            }
        }
        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);
        }