Esempio n. 1
0
        public static void addRecruit(int id, string vcode)
        {
            List <AccountEntry> chars   = new List <AccountEntry>();
            List <long>         CharNum = new List <long>();

            conn.Open();
            MySqlCommand addApi = new MySqlCommand("INSERT INTO `workflow`.`recruits` (`id`, `vID`, `vCode`) VALUES (NULL, '" + id + "', '" + vcode + "');", conn);

            try
            {
                addApi.ExecuteNonQuery();
                conn.Dispose();
                for (int i = 0; i < 3; i++)
                {
                    auth.KeyID         = id;
                    auth.VCode         = vcode;
                    api.Authentication = auth;
                    APIKeyInfo datInfo = api.getApiKeyInfo();
                    chars.AddRange(datInfo.Characters);
                    charIDs.CharacterID = chars[i].CharacterID;
                    CharNum.Add(charIDs.CharacterID);
                }
                conn.Open();
                MySqlCommand addChars = new MySqlCommand("UPDATE `workflow`.`recruits` SET `char_id1` = '" + CharNum[0] + "', `char_id2` = '" + CharNum[1] + "', `char_id3` = '" + CharNum[2] + "' WHERE `recruits`.`vID` = " + id + ";", conn);
                addChars.ExecuteNonQuery();
                conn.Dispose();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        public EVEveApi GetAPIInformation(int keyId, string vCode)
        {
            EVEveApi vapi = new EVEveApi();

            EveApi api = new EveApi(keyId, vCode);

            APIKeyInfo keyInfo = api.getApiKeyInfo();

            vapi.KeyId            = keyId;
            vapi.VerificationCode = vCode;
            vapi.IsActive         = false;

            if (keyInfo.Characters == null || keyInfo.Characters.Count == 0)
            {
                throw new ApplicationException(Translator.T("The API information for the account doesn't exist or it is expired"));
            }

            foreach (var character in keyInfo.Characters)
            {
                EVEveCharacter vchar = new EVEveCharacter();
                vchar.Name       = character.Name;
                vchar.EveId      = character.CharacterID;
                vchar.CorpName   = character.CorporationName;
                vchar.CorpId     = character.CorporationID;
                vchar.CorpTicker = GetCorpTicker(keyId, vCode, character.CorporationID.ToString());
                vapi.Characters.Add(vchar);
            }

            return(vapi);
        }