public static void PrintCharacterList()
        {
            CharacterList characterList = EveApi.GetAccountCharacters(2278819, "fTR02LZVWRTPTpC5pB5GAzPkWcPUAdVMr3qMjY7Ewia5QzYTGrao1pS6efvuIS1s");

            foreach (CharacterList.CharacterListItem cli in characterList.CharacterListItems)
            {
                Console.WriteLine("Name: {0} Corporation: {1}", cli.Name, cli.CorporationName);
            }
        }
        public static void PrintCharacterList()
        {
            CharacterList characterList = EveApi.GetAccountCharacters(453245, "apiKey");

            foreach (CharacterList.CharacterListItem cli in characterList.CharacterListItems)
            {
                Console.WriteLine("Name: {0} Corporation: {1}", cli.Name, cli.CorporationName);
            }
        }
Beispiel #3
0
        public void GetCharacterList()
        {
            CharacterList characterList = EveApi.GetAccountCharacters(756567, "asdf");

            Assert.AreEqual(3, characterList.CharacterListItems.Length);

            Assert.AreEqual("Mary", characterList.CharacterListItems[0].Name);
            Assert.AreEqual(150267069, characterList.CharacterListItems[0].CharacterId);
            Assert.AreEqual("Starbase Anchoring Corp", characterList.CharacterListItems[0].CorporationName);
            Assert.AreEqual(150279367, characterList.CharacterListItems[0].CorporationId);
        }
Beispiel #4
0
        public void CommonElementParsing()
        {
            ResponseCache.Clear();
            CharacterList characterList = EveApi.GetAccountCharacters(432435, "apiKey");

            DateTime currentTime = new DateTime(2007, 12, 12, 11, 48, 50);
            DateTime cachedUntil = new DateTime(2008, 12, 12, 12, 48, 50);

            Assert.AreEqual(currentTime, characterList.CurrentTime);
            Assert.AreEqual(cachedUntil, characterList.CachedUntil);
            Assert.AreEqual(currentTime.ToLocalTime(), characterList.CurrentTimeLocal);
            Assert.AreEqual(cachedUntil.ToLocalTime(), characterList.CachedUntilLocal);
            Assert.AreEqual(false, characterList.FromCache);
        }
Beispiel #5
0
        public void CharacterListPersist()
        {
            ResponseCache.Clear();
            CharacterList characterList = EveApi.GetAccountCharacters(342535, "asdf");

            ResponseCache.Save("ResponseCache.xml");
            ResponseCache.Clear();
            ResponseCache.Load("ResponseCache.xml");
            CharacterList cachedCharacterList = EveApi.GetAccountCharacters(3245345, "asdf");

            Assert.AreEqual(characterList.CachedUntilLocal, cachedCharacterList.CachedUntilLocal);
            Assert.AreEqual(cachedCharacterList.CharacterListItems.Length, characterList.CharacterListItems.Length);

            for (int i = 0; i < characterList.CharacterListItems.Length; i++)
            {
                Assert.AreEqual(characterList.CharacterListItems[i].Name, cachedCharacterList.CharacterListItems[i].Name);
                Assert.AreEqual(characterList.CharacterListItems[i].CharacterId, cachedCharacterList.CharacterListItems[i].CharacterId);
                Assert.AreEqual(characterList.CharacterListItems[i].CorporationName, cachedCharacterList.CharacterListItems[i].CorporationName);
                Assert.AreEqual(characterList.CharacterListItems[i].CorporationId, cachedCharacterList.CharacterListItems[i].CorporationId);
            }
        }
Beispiel #6
0
        //Check to see if input contains requested character
        //Return characterID of any that do.
        //Uses libeveapi
        private static int[] CheckCharacterExistence(User user, string input)
        {
            //Character userChar = mySession.CreateCriteria<Character>().Add(Restrictions.Eq("apiCharacterId", user.defaultChar)).UniqueResult<Character>();
            HashSet <UserApi> apis = new HashSet <UserApi>(user.apis);

            int[] charIDs = new int[MAX_NO_OF_CHARS];
            foreach (UserApi api in apis)
            {
                CharacterList eveChar = EveApi.GetAccountCharacters(api.apiUserId, api.apiKeyId);
                int           counter = 0;


                foreach (CharacterList.CharacterListItem character in eveChar.CharacterListItems)
                {
                    if (input.ToLower().Contains(character.Name.ToLower()))
                    {
                        charIDs[counter++] = character.CharacterId;
                    }
                }
            }
            return(charIDs);
        }
Beispiel #7
0
        //Print a list of characters from an account
        //Return a list of character ID's from account
        //Uses libeveapi
        int[] PrintCharacterList(User user, Input input)
        {
            //UserApi api = user.apis.ElementAt(0);
            int[] charIDList = new int[10];
            int   counter    = 1;

            foreach (UserApi api in user.apis)
            {
                CharacterList eveChar = EveApi.GetAccountCharacters(api.apiUserId, api.apiKeyId);
                foreach (CharacterList.CharacterListItem character in eveChar.CharacterListItems)
                {
                    Character eveCharacter = new Character(character.Name, character.CharacterId);
                    bool      foundChar    = false;
                    if (user.characters != null)
                    {
                        foreach (Character userCharacter in user.characters)
                        {
                            if (userCharacter.apiCharacterId == eveCharacter.apiCharacterId)
                            {
                                foundChar = true;
                            }
                        }
                    }
                    if (!foundChar)
                    {
                        eveCharacter.api = api;
                        user.addCharacter(eveCharacter);
                    }

                    addResponse(String.Format("{0} {1}", counter.ToString(), character.Name));
                    charIDList[counter - 1] = character.CharacterId;
                    counter++;
                }
            }
            return(charIDList);
        }