コード例 #1
0
        public bool ValidateStandings(string checkName, long checkCorpId, long checkAllianceId, int apiKey, string vcode)
        {
            bool          result    = false;
            List <double> standings = new List <double>();

            try
            {
                var newkey = EveXml.CreateApiKey(apiKey, vcode).Init();
                var cKey   = (CorporationKey)newkey.GetActualKey();

                List <long> list = new List <long>();
                list.Add(checkCorpId);
                if (checkAllianceId > 0)
                {
                    list.Add(checkAllianceId);
                }

                var api = new EveApi("R3MUS Recruitment", Convert.ToInt64(apiKey), vcode);

                Dictionary <long, string> dict = api.ConvertIDsToNames(list);

                string checkCorpName     = dict[checkCorpId];
                string checkAllianceName = string.Empty;
                if (dict.Count == 2)
                {
                    checkAllianceName = dict[checkAllianceId];
                }

                var cList = cKey.Corporation.GetContactList().Result;

                var contactList = cList.CorporationContacts.Concat(cList.AllianceContacts);

                var filteredContactList = contactList.Where
                                              (c =>
                                              (c.ContactName == checkName) || (c.ContactName == checkCorpName) || (c.ContactName == checkAllianceName)
                                              );

                foreach (var contact in filteredContactList)
                {
                    standings.Add(contact.Standing);
                    result = (contact.Standing == 10);
                    if (result)
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            { }

            if (result)
            {
                MemberType = IDType.Plus10.ToString();
                foreach (var value in Properties.Settings.Default.SharedCommsCorpIDs)
                {
                    if (value.Contains(checkCorpId.ToString()))
                    {
                        MemberType = IDType.SharedComms.ToString();
                        CorpId     = checkCorpId;
                        CorpTicker = value.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[0];
                    }
                }
            }
            else
            {
                if ((standings.Count == 0) || (standings.Min() >= 0.0))
                {
                    MemberType = IDType.Guest.ToString();
                }
            }

            return(result);
        }