示例#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);
            }
        }
示例#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);
        }
        private void BtnGetCharsClick(object sender, RoutedEventArgs e)
        {
            cbChars.Items.Clear();

            try
            {
                profile.keyId = tbKeyId.Text;
                profile.vcode = tbVCode.Text;

                var info = new APIKeyInfo(profile.keyId.ToString(CultureInfo.InvariantCulture), profile.vcode);
                info.Query();

                if (info.characters.Count == 0)
                {
                    MessageBox.Show(
                        "No characters for this API information.\nPlease check you API information",
                        "No characters found",
                        MessageBoxButton.OK,
                        MessageBoxImage.Warning
                        );
                }
                else
                {
                    lblChar.Visibility = Visibility.Visible;
                    cbChars.Visibility = Visibility.Visible;

                    foreach (APIKeyInfo.Character chr in info.characters)
                    {
                        var chara = new CharWrapper
                        {
                            KeyId    = profile.keyId,
                            VCode    = profile.vcode,
                            Charname = chr.characterName,
                            CharId   = chr.characterID
                        };

                        cbChars.Items.Add(chara);
                        cbChars.SelectedIndex = 0;
                    }
                    if (cbChars.Items.Count > 0)
                    {
                        btnOk.IsEnabled = true;
                    }
                }
            }
            catch (FormatException)
            {
                MessageBox.Show(
                    "Key ID must be a number",
                    "Invalid Key ID",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning
                    );
            }
        }
示例#4
0
        public static List <AccountEntry> getRecruits()
        {
            List <AccountEntry> recruits   = new List <AccountEntry>();
            MySqlCommand        getRecruit = new MySqlCommand("SELECT * FROM recruits order by id DESC", conn);

            conn.Open();
            MySqlDataReader rdr = getRecruit.ExecuteReader();

            while (rdr.Read())
            {
                auth.KeyID         = int.Parse(rdr.GetString("vID"));
                auth.VCode         = rdr.GetString("vCode");
                api.Authentication = auth;
                APIKeyInfo datInfo = api.getApiKeyInfo();
                recruits.AddRange(datInfo.Characters);
            }
            conn.Dispose();
            return(recruits);
        }