コード例 #1
0
ファイル: SkillQueueTests.cs プロジェクト: Lugghawk/libeveapi
        public void GetSkillInTraining()
        {
            ResponseCache.Clear();
            SkillQueue skillqueue = EveApi.GetSkillQueue(456456, 456436, "asdf");

            SkillQueue.Skill skill0 = skillqueue.SkillList[0];
            SkillQueue.Skill skill1 = skillqueue.SkillList[1];

            //Attributes of the first skill in the queue
            Assert.AreEqual(1, skill0.QueuePosition);
            Assert.AreEqual(11441, skill0.TrainingTypeId);
            Assert.AreEqual(3, skill0.TrainingToLevel);
            Assert.AreEqual(7072, skill0.TrainingStartSP);
            Assert.AreEqual(40000, skill0.TrainingEndSP);
            Assert.AreEqual(new DateTime(2009, 03, 18, 02, 01, 06), skill0.TrainingStartTime);
            Assert.AreEqual(new DateTime(2009, 03, 18, 15, 19, 21), skill0.TrainingEndTime);
            Assert.AreEqual(new DateTime(2009, 03, 17, 21, 01, 06), skill0.TrainingStartTimeLocal);
            Assert.AreEqual(new DateTime(2009, 03, 18, 10, 19, 21), skill0.TrainingEndTimeLocal);

            //Attributes of the second skill in the queue
            Assert.AreEqual(2, skill1.QueuePosition);
            Assert.AreEqual(20533, skill1.TrainingTypeId);
            Assert.AreEqual(4, skill1.TrainingToLevel);
            Assert.AreEqual(112000, skill1.TrainingStartSP);
            Assert.AreEqual(633542, skill1.TrainingEndSP);
            Assert.AreEqual(new DateTime(2009, 03, 18, 15, 19, 21), skill1.TrainingStartTime);
            Assert.AreEqual(new DateTime(2009, 03, 30, 03, 16, 14), skill1.TrainingEndTime);
            Assert.AreEqual(new DateTime(2009, 03, 18, 10, 19, 21), skill1.TrainingStartTimeLocal);
            Assert.AreEqual(new DateTime(2009, 03, 29, 22, 16, 14), skill1.TrainingEndTimeLocal);
        }
コード例 #2
0
        public void UsingStreams()
        {
            ResponseCache.Clear();
            string errorListLocation = Constants.ErrorList;

            Constants.ErrorList = "/ErrorListNotExpired.xml.aspx";

            ErrorList errorList = EveApi.GetErrorList();

            using (Stream s = new FileStream("ResponseCache.xml", FileMode.Create))
            {
                ResponseCache.Save(s);
            }

            ResponseCache.Clear();

            using (Stream s = new FileStream("ResponseCache.xml", FileMode.Open))
            {
                ResponseCache.Load(s);
            }

            ErrorList cached = EveApi.GetErrorList();

            Assert.AreEqual(errorList.CachedUntilLocal, cached.CachedUntilLocal);
            Assert.AreEqual(false, errorList.FromCache);
            Assert.AreEqual(true, cached.FromCache);

            Constants.ErrorList = errorListLocation;
        }
コード例 #3
0
ファイル: SkillQueueTests.cs プロジェクト: Lugghawk/libeveapi
        public void PersistSkillInTraining()
        {
            ResponseCache.Clear();
            SkillQueue skillqueue = EveApi.GetSkillQueue(56456, 4564356, "asdf");

            ResponseCache.Save("ResponseCache.xml");
            ResponseCache.Clear();
            ResponseCache.Load("ResponseCache.xml");
            SkillQueue cached = EveApi.GetSkillQueue(4563456, 36456, "asdf");

            //Test the Cache Time
            Assert.AreEqual(skillqueue.CachedUntilLocal, cached.CachedUntilLocal);

            //Attributes of the first skill in the queue
            Assert.AreEqual(cached.SkillList[0].QueuePosition, skillqueue.SkillList[0].QueuePosition);
            Assert.AreEqual(cached.SkillList[0].TrainingTypeId, skillqueue.SkillList[0].TrainingTypeId);
            Assert.AreEqual(cached.SkillList[0].TrainingToLevel, skillqueue.SkillList[0].TrainingToLevel);
            Assert.AreEqual(cached.SkillList[0].TrainingStartSP, skillqueue.SkillList[0].TrainingStartSP);
            Assert.AreEqual(cached.SkillList[0].TrainingEndSP, skillqueue.SkillList[0].TrainingEndSP);
            Assert.AreEqual(cached.SkillList[0].TrainingStartTime, skillqueue.SkillList[0].TrainingStartTime);
            Assert.AreEqual(cached.SkillList[0].TrainingEndTime, skillqueue.SkillList[0].TrainingEndTime);
            Assert.AreEqual(cached.SkillList[0].TrainingStartTimeLocal, skillqueue.SkillList[0].TrainingStartTimeLocal);
            Assert.AreEqual(cached.SkillList[0].TrainingEndTimeLocal, skillqueue.SkillList[0].TrainingEndTimeLocal);

            //Attributes of the second skill in the queue
            Assert.AreEqual(cached.SkillList[1].QueuePosition, skillqueue.SkillList[1].QueuePosition);
            Assert.AreEqual(cached.SkillList[1].TrainingTypeId, skillqueue.SkillList[1].TrainingTypeId);
            Assert.AreEqual(cached.SkillList[1].TrainingToLevel, skillqueue.SkillList[1].TrainingToLevel);
            Assert.AreEqual(cached.SkillList[1].TrainingStartSP, skillqueue.SkillList[1].TrainingStartSP);
            Assert.AreEqual(cached.SkillList[1].TrainingEndSP, skillqueue.SkillList[1].TrainingEndSP);
            Assert.AreEqual(cached.SkillList[1].TrainingStartTime, skillqueue.SkillList[1].TrainingStartTime);
            Assert.AreEqual(cached.SkillList[1].TrainingEndTime, skillqueue.SkillList[1].TrainingEndTime);
            Assert.AreEqual(cached.SkillList[1].TrainingStartTimeLocal, skillqueue.SkillList[1].TrainingStartTimeLocal);
            Assert.AreEqual(cached.SkillList[1].TrainingEndTimeLocal, skillqueue.SkillList[1].TrainingEndTimeLocal);
        }
コード例 #4
0
        public void FactionSystemsPersist()
        {
            ResponseCache.Clear();
            MapFacWarSystems systems = EveApi.GetFactionWarSystems();

            ResponseCache.Save("ResponseCache.xml");
            ResponseCache.Clear();
            ResponseCache.Load("ResponseCache.xml");
            MapFacWarSystems cache = EveApi.GetFactionWarSystems();

            Assert.AreEqual(cache.CachedUntilLocal, systems.CachedUntilLocal);
            Assert.AreEqual(cache.FactionWarSystems.Length, systems.FactionWarSystems.Length);

            for (int i = 0; i < systems.FactionWarSystems.Length; i++)
            {
                MapFacWarSystems.FactionWarSystem system = systems.FactionWarSystems[i];
                MapFacWarSystems.FactionWarSystem cached = cache.FactionWarSystems[i];

                Assert.AreEqual(cached.SolarSystemId, system.SolarSystemId);
                Assert.AreEqual(cached.SolarSystemName, system.SolarSystemName);
                Assert.AreEqual(cached.OccupyingFactionId, system.OccupyingFactionId);
                Assert.AreEqual(cached.OccupyingFactionName, system.OccupyingFactionName);
                Assert.AreEqual(cached.Contested, system.Contested);
            }
        }
コード例 #5
0
        public void StarbaseListPersist()
        {
            ResponseCache.Clear();
            StarbaseList starbaseList = EveApi.GetStarbaseList(432435, 234523, "apiKey");

            ResponseCache.Save("ResponseCache.xml");
            ResponseCache.Clear();
            ResponseCache.Load("ResponseCache.xml");

            StarbaseList cachedStarbaseList = EveApi.GetStarbaseList(432435, 234523, "apiKey");

            Assert.AreEqual(starbaseList.CachedUntilLocal, cachedStarbaseList.CachedUntilLocal);

            for (int i = 0; i < starbaseList.StarbaseListItems.Length; i++)
            {
                Assert.AreEqual(starbaseList.StarbaseListItems[i].ItemId, cachedStarbaseList.StarbaseListItems[i].ItemId);
                Assert.AreEqual(starbaseList.StarbaseListItems[i].TypeId, cachedStarbaseList.StarbaseListItems[i].TypeId);
                Assert.AreEqual(starbaseList.StarbaseListItems[i].LocationId, cachedStarbaseList.StarbaseListItems[i].LocationId);
                Assert.AreEqual(starbaseList.StarbaseListItems[i].MoonId, cachedStarbaseList.StarbaseListItems[i].MoonId);
                Assert.AreEqual(starbaseList.StarbaseListItems[i].State, cachedStarbaseList.StarbaseListItems[i].State);
                Assert.AreEqual(starbaseList.StarbaseListItems[i].StateTimestamp, cachedStarbaseList.StarbaseListItems[i].StateTimestamp);
                Assert.AreEqual(starbaseList.StarbaseListItems[i].OnlineTimestamp, cachedStarbaseList.StarbaseListItems[i].OnlineTimestamp);
                Assert.AreEqual(starbaseList.StarbaseListItems[i].StateTimestampLocal, cachedStarbaseList.StarbaseListItems[i].StateTimestampLocal);
                Assert.AreEqual(starbaseList.StarbaseListItems[i].OnlineTimestampLocal, cachedStarbaseList.StarbaseListItems[i].OnlineTimestampLocal);
            }
        }
コード例 #6
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);
        }
コード例 #7
0
        private static ProductType GetProductType(int shipTypeId)
        {
            EveApi      API;
            APIKeyInfo  KeyInfo;
            ProductType PType;

            try
            {
                API     = new EveApi("Clyde en Marland's API Checker", Properties.Settings.Default.CorpAPI, Properties.Settings.Default.VCode);
                KeyInfo = API.GetApiKeyInfo();

                PType = EveApi.EveApiCore.FindProductType(shipTypeId);
            }
            catch (Exception Ex)
            {
                PType             = new ProductType();
                PType.Name        = "Error querying API server";
                PType.Description = Ex.Message;
            }

            if (PType == null)
            {
                PType      = new ProductType();
                PType.Name = LookupShipName(shipTypeId);
            }

            return(PType);
        }
コード例 #8
0
        public void GetSkillTree()
        {
            ResponseCache.Clear();
            SkillTree skillTree = EveApi.GetSkillTree();

            SkillTree.Skill skill = findSkill(3368, skillTree);

            Assert.AreEqual("Ethnic Relations", skill.TypeName);
            Assert.AreEqual(266, skill.GroupId);
            Assert.AreEqual(3368, skill.TypeId);
            Assert.AreEqual("Skill at operating multiracial", skill.Description.Substring(0, 30));
            Assert.AreEqual(2, skill.Rank);

            Assert.AreEqual(2, skill.RequiredSkills.Length);
            Assert.AreEqual(3363, skill.RequiredSkills[0].TypeId);
            Assert.AreEqual(2, skill.RequiredSkills[0].SkillLevel);
            Assert.AreEqual(3355, skill.RequiredSkills[1].TypeId);
            Assert.AreEqual(3, skill.RequiredSkills[1].SkillLevel);

            Assert.AreEqual(SkillTree.AttributeType.Memory, skill.PrimaryAttribute);
            Assert.AreEqual(SkillTree.AttributeType.Charisma, skill.SecondaryAttribute);

            Assert.AreEqual(1, skill.SkillBonuses.Length);
            Assert.AreEqual("nonRaceCorporationMembersBonus", skill.SkillBonuses[0].BonusType);
            Assert.AreEqual(20, skill.SkillBonuses[0].BonusValue);

            Assert.AreEqual("Corporation Management", skillTree.SkillGroups[0].GroupName);
            Assert.AreEqual(266, skillTree.SkillGroups[0].GroupId);
        }
コード例 #9
0
        public void GetRefTypeList()
        {
            RefTypes referenceType = EveApi.GetRefTypesList();

            Assert.AreEqual("Undefined", referenceType.GetReferenceTypeNameForId(0));
            Assert.AreEqual("Player Trading", referenceType.GetReferenceTypeNameForId(1));
        }
コード例 #10
0
        public void TestCharIdToName()
        {
            CharacterIdName charId = EveApi.GetCharacterIdName("test123");

            Assert.AreEqual(797400947, charId.CharacterIdItems[0].CharacterId);
            Assert.AreEqual("CCP Garthagk", charId.CharacterIdItems[0].Name);
        }
コード例 #11
0
        public async Task MultiplePilots()
        {
            long   code   = 3483492;
            string vcode  = "ZwML01eU6aQUVIEC7gedCEaySiNxRTJxgWo2qoVnxd5duN4tt4CWgMuYMSVNWIUG";
            long   code2  = 3192744;
            string vcode2 = "OOYpSnhWTsgJpRVo475E67q9XSeHx42KgDy13DYAogFptaA8uidOrhbrCLfy31MC";

            var keyRepoMock = new Mock <IKeyInfoRepo>();

            keyRepoMock.Setup(x => x.GetKeys(1))
            .Returns(Task.FromResult((ICollection <KeyInfo>)(new KeyInfo[] { new KeyInfo()
                                                                             {
                                                                                 KeyId = code, VCode = vcode
                                                                             }, new KeyInfo()
                                                                             {
                                                                                 KeyId = code2, VCode = vcode2
                                                                             } }.ToList())));

            var api = new EveApi(Logger, EveCache);
            var pilotLocalService = new EvePilotDataService(keyRepoMock.Object, api, Logger, TypeNameDict);

            var result = await pilotLocalService.Get(1);

            Assert.AreEqual(3, result.Item1.Count);
            Assert.AreEqual(3, result.Item1.Select(x => x.Name).Distinct().Count());

            Assert.AreEqual(0, result.Item2.Count);
        }
コード例 #12
0
        public async Task SinglePilot2()
        {
            long   code  = 3483492;
            string vcode = "ZwML01eU6aQUVIEC7gedCEaySiNxRTJxgWo2qoVnxd5duN4tt4CWgMuYMSVNWIUG";

            var keyRepoMock = new Mock <IKeyInfoRepo>();

            keyRepoMock.Setup(x => x.GetKeys(1))
            .Returns(Task.FromResult((ICollection <KeyInfo>)(new KeyInfo[] { new KeyInfo()
                                                                             {
                                                                                 KeyId = code, VCode = vcode, KeyInfoId = code + 1
                                                                             } }.ToList())));

            var api = new EveApi(Logger, EveCache);
            var pilotLocalService = new EvePilotDataService(keyRepoMock.Object, api, Logger, TypeNameDict);

            var result = await pilotLocalService.Get(1);

            Assert.AreEqual(1, result.Item1.Count);
            //Assert.IsFalse(result.Item1[0].CloneNotUpToDate);
            Assert.IsTrue((result.Item1[0].CurrentTrainingEnd - DateTime.UtcNow).TotalMilliseconds >= 0);
            Assert.IsTrue((result.Item1[0].TrainingQueueEnd - DateTime.UtcNow).TotalMilliseconds >= 0);
            Assert.AreEqual("MicioGatto", result.Item1[0].Name);
            Assert.AreEqual(10, result.Item1[0].MaxManufacturingJobs);
            Assert.AreEqual(10, result.Item1[0].MaxResearchJobs);

            Assert.AreEqual(code + 1, result.Item1[0].KeyInfoId);
            Assert.AreEqual(0, result.Item2.Count);
        }
コード例 #13
0
ファイル: Form1.cs プロジェクト: kaas-/ReconnectedServerStuff
        private ProductType GetProductType(int shipTypeId)
        {
            long   KeyID = 4086267;
            string VCode = "HUkqOyewFYvuSkWgDoCOH1L2juXnaxh3gCLDT1qwAfrpYt381CkT6XeZ8qe2rpH0";

            KeyID = 3704919;
            VCode = "JXcmbP0t9NCR6rld6qxOvbDFomx076ZERIs84p5XoBn0IYzVJJX1Jj6bIEYhBKlk";

            EveApi     API;
            APIKeyInfo KeyInfo;
            List <AccountCharacter> Characters;
            List <CorporationMemberTrackingEntry> CorpMembers;
            ProductType PType;

            try
            {
                API     = new EveApi("Clyde en Marland's API Checker", KeyID, VCode);
                KeyInfo = API.GetApiKeyInfo();

                PType = EveApi.EveApiCore.FindProductType(shipTypeId);
            }
            catch (Exception Ex)
            {
                PType             = new ProductType();
                PType.Name        = "Error querying API server";
                PType.Description = Ex.Message;
            }

            return(PType);
        }
コード例 #14
0
        public async Task CreationMask()
        {
            long   code  = 3785350;
            string vcode = "Nm1mfKsbFukmkMgCoMsk75QzVwVVjRKLpS4o3Zbc4cFgY11TBa9i25cUDAljB2d4";

            var keyRepoMock = new Mock <IKeyInfoRepo>();

            keyRepoMock.Setup(x => x.GetKeys(1))
            .Returns(Task.FromResult((ICollection <KeyInfo>)(new KeyInfo[] { new KeyInfo()
                                                                             {
                                                                                 KeyId = code, VCode = vcode, KeyInfoId = code + 1
                                                                             } }.ToList())));

            var api = new EveApi(Logger, EveCache);
            var pilotLocalService = new EvePilotDataService(keyRepoMock.Object, api, Logger, TypeNameDict);

            var result = await pilotLocalService.Get(1);

            Assert.AreEqual(3, result.Item1.Count);
            Assert.AreEqual(3, result.Item1.Select(x => x.Name).Distinct().Count());

            Assert.AreEqual(code + 1, result.Item1[0].KeyInfoId);
            Assert.AreEqual(code + 1, result.Item1[1].KeyInfoId);
            Assert.AreEqual(code + 1, result.Item1[2].KeyInfoId);
        }
コード例 #15
0
        public async Task SinglePilot()
        {
            long   code  = 3327094;
            string vcode = "yb6Yi3CzuAW248DqcFY9zEwThGFsMe8EEkcqLgfFd8d4smXvv8N7Fv1I6Ei37rc5";

            var keyRepoMock = new Mock <IKeyInfoRepo>();

            keyRepoMock.Setup(x => x.GetKeys(1))
            .Returns(Task.FromResult((ICollection <KeyInfo>)(new KeyInfo[] { new KeyInfo()
                                                                             {
                                                                                 KeyId = code, VCode = vcode, KeyInfoId = code + 1
                                                                             } }.ToList())));

            var api = new EveApi(Logger, EveCache);
            var pilotLocalService = new EvePilotDataService(keyRepoMock.Object, api, Logger, TypeNameDict);

            var result = await pilotLocalService.Get(1);

            Assert.AreEqual(1, result.Item1.Count);
            //Assert.IsTrue((result.Item1[0].CurrentTrainingEnd - DateTime.UtcNow).TotalMilliseconds >= 0);
            //Assert.IsTrue((result.Item1[0].TrainingQueueEnd-DateTime.UtcNow).TotalMilliseconds >= 0);
            Assert.AreEqual("Tomek 3", result.Item1[0].Name);
            Assert.AreEqual(1, result.Item1[0].MaxManufacturingJobs);
            Assert.AreEqual(1, result.Item1[0].MaxResearchJobs);

            Assert.AreEqual(code + 1, result.Item1[0].KeyInfoId);
            Assert.AreEqual(0, result.Item2.Count);
        }
コード例 #16
0
        public override void action(IrcConnection connection, string channel)
        {
            IList <Character> characters = IrcBot.mySession.CreateCriteria <Character>().List <Character>();

            foreach (Character character in characters)
            {
                //Get their skillQueue, and determine if time remaining is less than 24 hours.
                SkillQueue skillQueue = null;
                try
                {
                    skillQueue = EveApi.GetSkillQueue(character.api.apiUserId, character.apiCharacterId, character.api.apiKeyId);
                }
                catch (FormatException)
                {
                    continue;
                }
                catch (Exception)
                {
                    continue;
                }
                if (skillQueue == null)
                {
                    continue;
                }
                DateTime tomorrow = DateTime.Now + new TimeSpan(24, 0, 0);//24 hours

                if (skillQueue.SkillList.Length > 0)
                {
                    if (skillQueue.SkillList.Last().TrainingEndTimeLocal < tomorrow) // If the skill finishes before tomorrow.
                    {
                        connection.privmsg(channel, "Character " + character.characterName + " has less than 24 hours remaining in his skill queue");
                    }
                }
            }
        }
コード例 #17
0
        public void StarbaseDetailPersist()
        {
            ResponseCache.Clear();
            StarbaseDetail starbaseDetail = EveApi.GetStarbaseDetail(432435, 234523, "fullApiKey", 25245);

            ResponseCache.Save("ResponseCache.xml");
            ResponseCache.Clear();
            ResponseCache.Load("ResponseCache.xml");

            StarbaseDetail cachedStarbaseDetail = EveApi.GetStarbaseDetail(432435, 234523, "fullApiKey", 25245);

            Assert.AreEqual(starbaseDetail.CachedUntilLocal, cachedStarbaseDetail.CachedUntilLocal);

            Assert.AreEqual(starbaseDetail.UsageFlags, cachedStarbaseDetail.UsageFlags);
            Assert.AreEqual(starbaseDetail.DeployFlags, cachedStarbaseDetail.DeployFlags);
            Assert.AreEqual(starbaseDetail.AllowCorporationMembers, cachedStarbaseDetail.AllowCorporationMembers);
            Assert.AreEqual(starbaseDetail.AllowAllianceMembers, cachedStarbaseDetail.AllowAllianceMembers);
            Assert.AreEqual(starbaseDetail.ClaimSovereignty, cachedStarbaseDetail.ClaimSovereignty);

            Assert.AreEqual(starbaseDetail.OnStandingDropEnabled, cachedStarbaseDetail.OnStandingDropEnabled);
            Assert.AreEqual(starbaseDetail.OnStandingDropStanding, cachedStarbaseDetail.OnStandingDropStanding);
            Assert.AreEqual(starbaseDetail.OnStatusDropEnabled, cachedStarbaseDetail.OnStatusDropEnabled);
            Assert.AreEqual(starbaseDetail.OnStatusDropStanding, cachedStarbaseDetail.OnStatusDropStanding);
            Assert.AreEqual(starbaseDetail.OnAgressionEnabled, cachedStarbaseDetail.OnAgressionEnabled);
            Assert.AreEqual(starbaseDetail.OnCorporationWarEnabled, cachedStarbaseDetail.OnCorporationWarEnabled);

            for (int i = 0; i < starbaseDetail.FuelList.Length; i++)
            {
                Assert.AreEqual(starbaseDetail.FuelList[i].TypeId, cachedStarbaseDetail.FuelList[i].TypeId);
                Assert.AreEqual(starbaseDetail.FuelList[i].Quantity, cachedStarbaseDetail.FuelList[i].Quantity);
            }
        }
コード例 #18
0
ファイル: Examples.cs プロジェクト: Lugghawk/libeveapi
        public static void MemberTrackingExample()
        {
            MemberTracking memberTracking = EveApi.GetMemberTracking(1234, 5678, "fullApiKey");

            // Output the name and location of all corporation directors
            foreach (MemberTracking.Member member in memberTracking.Members)
            {
                Console.WriteLine("CharacterId: {0}", member.CharacterId);
                Console.WriteLine("Name: {0}", member.Name);
                Console.WriteLine("StartDateTime: {0}", member.StartDateTime);
                Console.WriteLine("StartDateTimeLocal: {0}", member.StartDateTimeLocal);
                Console.WriteLine("BaseId: {0}", member.BaseId);
                Console.WriteLine("Base: {0}", member.Base);
                Console.WriteLine("Title: {0}", member.Title);
                Console.WriteLine("LogonDateTime: {0}", member.LogonDateTime);
                Console.WriteLine("LogonDateTimeLocal: {0}", member.LogonDateTimeLocal);
                Console.WriteLine("LogoffDateTime: {0}", member.LogoffDateTime);
                Console.WriteLine("LogoffDateTimeLocal: {0}", member.LogoffDateTimeLocal);
                Console.WriteLine("LocationId: {0}", member.LocationId);
                Console.WriteLine("Location: {0}", member.Location);
                Console.WriteLine("ShipTypeId: {0}", member.ShipTypeId);
                Console.WriteLine("ShipType: {0}", member.ShipType);
                Console.WriteLine("RolesMask: {0}", member.RolesMask);
                Console.WriteLine("GrantableRoles: {0}", member.GrantableRoles);
                Console.Write("Roles: ");
                foreach (RoleTypes role in member.Roles.RoleList)
                {
                    Console.Write("{0}, ", role.ToString());
                }
                Console.WriteLine("\n\n*************************************\n");
            }
        }
コード例 #19
0
ファイル: Eve_Testing.cs プロジェクト: baseonmars/EveCS
        public Eve_Testing()
        {
            EveApi theThing = new EveApi (keyID, vCode, characterID);

            Console.WriteLine ("Character Name is: " + theThing.GetCharacterInfo());
            Console.ReadLine();
        }
コード例 #20
0
ファイル: IrcBot.cs プロジェクト: Lugghawk/eveircbot
        //Print the current character balance. Use separate charID.
        //Uses libeveapi
        //Says to channel
        private static void PrintAccountBalance(User user, int characterID)
        {
            Character      eveChar   = mySession.CreateCriteria <Character>().Add(Restrictions.Eq("apiCharacterId", characterID)).UniqueResult <Character>();
            UserApi        api       = eveChar.api;
            CharacterSheet character = EveApi.GetCharacterSheet(api.apiUserId, characterID, api.apiKeyId);

            connection.privmsg(CHANNEL, String.Format("{0} has {1} isk", character.Name, character.Balance.ToString("N")));
        }
コード例 #21
0
ファイル: Examples.cs プロジェクト: Lugghawk/libeveapi
        public static void PrintAllAssets()
        {
            AssetList assetList = EveApi.GetAssetList(AssetListType.Corporation, 1237, 453, "fullApiKey");

            foreach (AssetList.AssetListItem ali in assetList.AssetListItems)
            {
                PrintAsset(ali);
            }
        }
コード例 #22
0
ファイル: Examples.cs プロジェクト: Lugghawk/libeveapi
        public static void PrintStarbaseList()
        {
            StarbaseList starbaseList = EveApi.GetStarbaseList(5385, 5431487, "fullApiKey");

            foreach (StarbaseList.StarbaseListItem sli in starbaseList.StarbaseListItems)
            {
                Console.WriteLine("ItemID: {0} LocationID: {1} State: {2}", sli.ItemId, sli.LocationId, sli.State);
            }
        }
コード例 #23
0
ファイル: Examples.cs プロジェクト: Lugghawk/libeveapi
        public static void ConquerableStationListExample()
        {
            ConquerableStationList csl = EveApi.GetConquerableStationList();

            foreach (ConquerableStationList.ConquerableStation station in csl.ConquerableStations)
            {
                Console.WriteLine("Station Name: {0} Corporation Name: {1}", station.StationName, station.CorporationName);
            }
        }
コード例 #24
0
ファイル: Examples.cs プロジェクト: Lugghawk/libeveapi
        public static void MapSovereigntyExample()
        {
            MapSovereignty ms = EveApi.GetMapSovereignty();

            foreach (MapSovereignty.MapSovereigntyItem msi in ms.MapSystemSovereigntyItems)
            {
                Console.WriteLine("System Name: {0} FactionId: {1}", msi.SolarSystemName, msi.FactionId);
            }
        }
コード例 #25
0
        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);
            }
        }
コード例 #26
0
ファイル: ErrorListTests.cs プロジェクト: Lugghawk/libeveapi
        public void GetErrorList()
        {
            ResponseCache.Clear();
            ErrorList errorList = EveApi.GetErrorList();

            Assert.AreEqual("Expected before ref/trans ID = 0: wallet not previously loaded.", errorList.GetMessageForErrorCode("100"));
            Assert.AreEqual("Current security level not high enough.", errorList.GetMessageForErrorCode("200"));
            Assert.AreEqual("User forced test error condition.", errorList.GetMessageForErrorCode("999"));
        }
コード例 #27
0
        public static void PrintAccounts()
        {
            AccountBalance accountBalance = EveApi.GetAccountBalance(AccountBalanceType.Corporation, 1234, 2567, "fullApiKey");

            foreach (AccountBalance.AccountBalanceItem abi in accountBalance.AccountBalanceItems)
            {
                Console.WriteLine("id: {0} key: {1} balance: {2}", abi.AccountId, abi.AccountKey, abi.Balance);
            }
        }
コード例 #28
0
ファイル: Examples.cs プロジェクト: Lugghawk/libeveapi
        public static void MapJumpsExample()
        {
            MapJumps mapJumps = EveApi.GetMapJumps();

            foreach (MapJumps.MapSystemItem system in mapJumps.MapSystemJumps)
            {
                Console.WriteLine("System: {0} Number of Jumps: {1}", system.SolarSystemId, system.ShipJumps);
            }
        }
コード例 #29
0
        public void GetServerStatusTest()
        {
            ResponseCache.Clear();

            ServerStatus serverStatus = EveApi.GetServerStatus();

            Assert.AreEqual(true, serverStatus.ServerOpen);
            Assert.AreEqual(28968, serverStatus.OnlinePlayers);
        }
コード例 #30
0
        public void StationData()
        {
            ConquerableStationList stationList = EveApi.GetConquerableStationList();

            Assert.AreEqual(233, stationList.ConquerableStations.Length);
            Assert.AreEqual(60014926, stationList.ConquerableStations[0].StationId);
            Assert.AreEqual("The Alamo", stationList.ConquerableStations[0].StationName);
            Assert.AreEqual(12295, stationList.ConquerableStations[0].StationTypeId);
        }
コード例 #31
0
        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);
            }
        }
コード例 #32
0
        public void InitAccounts(List<EveApiKey> accountsList)
        {
            if(accountsList == null)
                return;

            foreach (var eveApiKey in accountsList)
            {
                var api = new EveApi(eveApiKey.KeyId, eveApiKey.VCode, eveApiKey.CharacterId);
                ApiDic.Add(eveApiKey.CharacterId, api);
            }
        }
コード例 #33
0
ファイル: HomeController.cs プロジェクト: jorupp/eveTools
        public ActionResult Assets(string id, bool isCorp, int characterId)
        {
            var key = _apiKeyRepository.GetById(id);
            if (null == key)
                return HttpNotFound();
            var api = new EveApi(key.keyId, key.vCode, characterId);
            var assets = isCorp ? api.GetCorporationAssets() : api.GetCharacterAssets();

            var summary = BuildLocationSummaries(assets);
            summary.Sort((a, b) => a.TotalValue < b.TotalValue ? 1 : a.TotalValue == b.TotalValue ? 0 : -1);

            var character = key.keyInfo.Characters.Single(i => i.CharacterID == characterId);
            return View(new AssetsViewModel()
            {
                Entity = isCorp ? character.CorporationName : character.Name,
                Assets = summary,
            });
        }
コード例 #34
0
ファイル: IndustryController.cs プロジェクト: jorupp/eveTools
        // GET: Industry
        public ActionResult Index(string id, bool isCorp, int characterId)
        {
            var key = _apiKeyRepository.GetById(id);
            if (null == key)
                return HttpNotFound();
            var accountMap =
                _apiKeyRepository.GetAll()
                    .SelectMany(i => i.keyInfo.Characters.Select(ii => new {ii.CharacterID, AccountName = i.name}))
                    .GroupBy(i => i.CharacterID)
                    .ToDictionary(i => i.Key, i => i.First().AccountName);
            var api = new EveApi(key.keyId, key.vCode, characterId);
            var currentJobs = isCorp ? api.Get<CorpUpdatedIndustryJobApi>().Data : api.Get<CharUpdatedIndustryJobApi>().Data; ;
            var allJobs = isCorp ? api.Get<CorpHistoryUpdatedIndustryJobApi>().Data : api.Get<CharHistoryUpdatedIndustryJobApi>().Data;

            var model = (from j in allJobs
                         group j by new { j.InstallerID, j.Activity } into groups
                             join current in currentJobs.GroupBy(i => new { i.InstallerID, i.Activity }) on groups.Key equals
                                 current.Key into currentGroup
                             from current in currentGroup.DefaultIfEmpty()
                             let timeRemaining = (current ?? (IEnumerable<UpdatedIndustryJob>)new UpdatedIndustryJob[0]).Select(i => i.End.Subtract(DateTime.UtcNow)).Where(i => i.TotalSeconds > 0).OrderBy(i => i.TotalSeconds).ToList()
                             let maxConcurrent = GetMaxConcurrent(groups)
                             select new IndustryStatusModel
                             {
                                 AccountName = accountMap.FirstOrDefault(i => i.Key == groups.Key.InstallerID).Value,
                                 InstallerID = groups.Key.InstallerID,
                                 InstallerName = api.GetCharacterNameLookup(new List<long>() { groups.Key.InstallerID })[groups.Key.InstallerID],
                                 Activity = groups.Key.Activity,
                                 LatestInstalledJob = groups.Concat((IEnumerable<UpdatedIndustryJob>) current ?? new UpdatedIndustryJob[0]).Max(i => i.Start),
                                 MaxJobCount = maxConcurrent,
                                 CurrentJobCount = timeRemaining.Count(),
                                 TimeUntilNextComplete = timeRemaining.Cast<TimeSpan?>().FirstOrDefault(),
                                 TimeUntilLastComplete = timeRemaining.Cast<TimeSpan?>().LastOrDefault(),
                             }).ToList();

            return View(model);
        }
コード例 #35
0
        private ProductType GetProductType(int shipTypeId)
        {
            long KeyID = 4086267;
            string VCode = "HUkqOyewFYvuSkWgDoCOH1L2juXnaxh3gCLDT1qwAfrpYt381CkT6XeZ8qe2rpH0";

            KeyID = 3704919;
            VCode = "JXcmbP0t9NCR6rld6qxOvbDFomx076ZERIs84p5XoBn0IYzVJJX1Jj6bIEYhBKlk";

            EveApi API;
            APIKeyInfo KeyInfo;
            List<AccountCharacter> Characters;
            List<CorporationMemberTrackingEntry> CorpMembers;
            ProductType PType;

            try
            {
                API = new EveApi("Clyde en Marland's API Checker", KeyID, VCode);
                KeyInfo = API.GetApiKeyInfo();

                PType = EveApi.EveApiCore.FindProductType(shipTypeId);
            }
            catch (Exception Ex)
            {
                PType = new ProductType();
                PType.Name = "Error querying API server";
                PType.Description = Ex.Message;
            }

            return PType;
        }
コード例 #36
0
ファイル: EveIntel.cs プロジェクト: CzBuCHi/eve-intel-map
        public void UpdateLocal(Guid clientId, long solarsystemID, string[] characterNames)
        {
            _Logger.Info("UpdateLocal: " + clientId);
            ClientInfo clientInfo;
            lock (_ClientsLock) {
                if (!_Clients.TryGetValue(clientId, out clientInfo)) {
                    return;
                }
            }

            EveApi eveApi = new EveApi(clientInfo.KeyId, clientInfo.VCode);
            Dictionary<long, string> characters = eveApi.GetCharacterIDLookup(characterNames.ToList()).ToDictionary(o => o.Value, o => o.Key);
            EveIntelCharacterInfo[] characterInfos = GetEveIntelCharacterInfos(solarsystemID, characters);

            DelayedBroadcast(new BroadcastMessage {
                Action = client => { client.ClientIntelUpdate(characterInfos); },
                DebugInfo = "ClientLocalUpdate"
            });
        }
コード例 #37
0
ファイル: EveIntel.cs プロジェクト: CzBuCHi/eve-intel-map
        public Guid? Connect(long keyId, string vCode, long solarsystemID)
        {
            // check for connection with same keyId & vCode
            int hashCode = new {keyId, vCode}.GetHashCode();
            lock (_ClientsLock) {
                Guid clientId;
                if (_ClientHashes.TryGetValue(hashCode, out clientId)) {
                    _ClientHashes.Remove(hashCode);
                    // inform first client and disconnect him
                    DelayedBroadcast(new BroadcastMessage {
                        Action = client => {
                            client.SecondConnection(solarsystemID);
                            lock (_ClientsLock) {
                                _Clients.Remove(clientId);
                            }
                        },
                        DebugInfo = "SecondConnection",
                        Clients = new[] {clientId}
                    });
                    DelayedBroadcast(new BroadcastMessage {
                        Action = client => { client.ClientCountUpdate(_Clients.Count); },
                        DebugInfo = "ClientCountUpdate"
                    });
                    _Logger.Info("Dupliacate connection: " + keyId);
                    return null;
                }
            }

            // get client callback
            IEveIntelCallback callback;
            try {
                callback = OperationContext.Current.GetCallbackChannel<IEveIntelCallback>();
            } catch (Exception exc) {
                _Logger.Error("Connect: get IEveIntelCallback: ", exc);
                // invalid client
                return null;
            }

            // connect to eve api and get all player character names
            Dictionary<long, string> characters;
            try {
                EveApi eveApi = new EveApi(keyId, vCode);
                characters = eveApi.GetAccountEntries().ToDictionary(o => o.CharacterID, o => o.Name);
            } catch (Exception) {
                // invalid key/vCode
                _Logger.Warn("Connect: invalid key/vCode: " + keyId + ", '" + vCode + "'");
                return null;
            }

            if (characters.Count == 0) {
                _Logger.Warn("Connect: invalid key/vCode (no characters): " + keyId + ", '" + vCode + "'");
                return null;
            }

            // kos check against all player characters
            EveIntelCharacterInfo[] characterInfos = GetEveIntelCharacterInfos(solarsystemID, characters);
            EveIntelCharacterInfo[] kosInfos = characterInfos.Where(o => o.Kos).ToArray();
            if (kosInfos.Length > 0) {
                _Logger.Warn("Connect: kos characters: '" + string.Join("', '", kosInfos.Select(o => o.CharacterName)));
                return null;
            }

            // generate client id
            Guid result = Guid.NewGuid();
            lock (_ClientsLock) {
                _Clients.Add(result, new ClientInfo {
                    Callback = callback,
                    KeyId = keyId,
                    VCode = vCode,
                    HashCode = hashCode
                });

                // DEBUG CODE
                if (!_ClientHashes.ContainsKey(hashCode)) {
                    _ClientHashes.Add(hashCode, result);
                }
            }

            DelayedBroadcast(new BroadcastMessage {
                Action = client => { client.ClientCountUpdate(_Clients.Count); },
                DebugInfo = "ClientCountUpdate"
            });

            _Logger.Info("Connect: " + result + " (" + string.Join(", ", characterInfos.Select(o => o.CharacterName)) + ")");
            return result;
        }
コード例 #38
0
 public bool CheckApiKey(EveApiKey apiKey)
 {
     var anonApi = new EveApi(apiKey.KeyId, apiKey.VCode);
     return anonApi.GetAccountEntries().Count > 0;
 }
コード例 #39
0
        private static EveAI.Map.SolarSystem GetSolarSystem(int systemId)
        {
            EveApi API;
            APIKeyInfo KeyInfo;
            EveAI.Map.SolarSystem system;

            try
            {
                API = new EveApi("Clyde en Marland's API Checker", Properties.Settings.Default.CorpAPI, Properties.Settings.Default.VCode);
                KeyInfo = API.GetApiKeyInfo();

                system = EveApi.EveApiCore.FindSolarSystem(systemId);
            }
            catch (Exception Ex)
            {
                system = new EveAI.Map.SolarSystem();
                system.Name = string.Concat("Error querying API server; ", Ex.Message);
            }

            return system;
        }
コード例 #40
0
        private static ProductType GetProductType(int shipTypeId)
        {
            EveApi API;
            APIKeyInfo KeyInfo;
            ProductType PType;

            try
            {
                API = new EveApi("Clyde en Marland's API Checker", Properties.Settings.Default.CorpAPI, Properties.Settings.Default.VCode);
                KeyInfo = API.GetApiKeyInfo();

                PType = EveApi.EveApiCore.FindProductType(shipTypeId);
            }
            catch (Exception Ex)
            {
                PType = new ProductType();
                PType.Name = "Error querying API server";
                PType.Description = Ex.Message;
            }

            if (PType == null)
            {
                PType = new ProductType();
                PType.Name = LookupShipName(shipTypeId);
            }

            return PType;
        }
コード例 #41
0
        private static CorporationSheet GetCorpDetails()
        {
            EveApi API = new EveApi("Clyde en Marland's KillBot", Properties.Settings.Default.CorpAPI, Properties.Settings.Default.VCode);

            return API.GetCorporationSheet();
        }