private static CachedData <List <ConquerableStation> > GetConquerableStationsBySystemIdSync() { //TODO kann man auch verallgemeinern var doc = XDocumentWebRequester.RequestCcpApiXmlDocument( "https://api.eveonline.com/eve/ConquerableStationList.xml.aspx"); var fwStats = doc.Descendants("row") .Select( x => new ConquerableStation { SolarSystemId = x.GetLongAttributeValue("solarSystemID"), StationName = x.GetAttributeValue("stationName") }); var cachedUntil = DateTime.ParseExact(doc.Descendants("cachedUntil").First().Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); return(new CachedData <List <ConquerableStation> > { Value = fwStats.ToList(),//new Dictionary<long, List<object>>(fwStats.GroupBy(x => x.SolarSystemId).ToDictionary(x => x.Key, y => y.Select(a => new Station { Name = a.StationName }).Cast<object>().ToList())), CachedUntil = cachedUntil }); }
private static XDocument GetApiInfoDocument(string vCode, int keyId) { var url = string.Format("https://api.eveonline.com/account/APIKeyInfo.xml.aspx?keyId={0}&vCode={1}", keyId, vCode); return(XDocumentWebRequester.RequestCcpApiXmlDocument(url)); }
private static CachedData <IDictionary <long, Alliance> > GetAlliancesSync() { //without version=1 member corps are also included var doc = XDocumentWebRequester.RequestCcpApiXmlDocument( "https://api.eveonline.com/eve/AllianceList.xml.aspx?version=1"); var alliances = doc.Descendants("row") .Select( x => new Alliance { Id = x.GetLongAttributeValue("allianceID"), Name = x.GetAttributeValue("name"), Ticker = x.GetAttributeValue("shortName") }) .ToList(); var cachedUntil = DateTime.ParseExact(doc.Descendants("cachedUntil").First().Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); return(new CachedData <IDictionary <long, Alliance> > { Value = alliances.ToDictionary(x => x.Id, y => y), CachedUntil = cachedUntil }); }
private static CachedData <IDictionary <long, KillsBySystem> > GetKillsBySystem() { //TODO kann man auch verallgemeinern var doc = XDocumentWebRequester.RequestCcpApiXmlDocument( "https://api.eveonline.com/map/Kills.xml.aspx"); var killsBySystem = doc.Descendants("row") .Select( x => new KillsBySystem() { ShipKillCount = x.GetIntAttributeValue("shipKills"), SolarSystemId = x.GetLongAttributeValue("solarSystemID"), NpcKillCount = x.GetIntAttributeValue("factionKills"), PodKillCount = x.GetIntAttributeValue("podKills") }) .ToList(); var cachedUntil = DateTime.ParseExact(doc.Descendants("cachedUntil").First().Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); return(new CachedData <IDictionary <long, KillsBySystem> > { Value = killsBySystem.ToDictionary(x => x.SolarSystemId, x => x), CachedUntil = cachedUntil }); }
private static XDocument GetContactListDocument(string characterId, long keyId, string vCode) { return(XDocumentWebRequester.RequestCcpApiXmlDocument( string.Format( "https://api.eveonline.com/char/ContactList.xml.aspx?keyId={0}&vCode={1}&characterID={2}", keyId, vCode, characterId))); }
private static CachedData <IDictionary <long, FactionWarfareOccupancy> > GetFactionWarefeStatsSync() { //TODO kann man auch verallgemeinern var doc = XDocumentWebRequester.RequestCcpApiXmlDocument( "https://api.eveonline.com/map/FacWarSystems.xml.aspx"); var fwStats = doc.Descendants("row") .Select( x => new FactionWarfareOccupancy { OwningFactionId = x.GetLongAttributeValue("owningFactionID"), SolarSystemId = x.GetLongAttributeValue("solarSystemID"), OccupyingFactionId = x.GetLongAttributeValue("occupyingFactionID"), OccupyingFaction = x.GetAttributeValue("occupyingFactionName"), IsContested = x.GetBoolAttributeValue("contested") }) .ToList(); var cachedUntil = DateTime.ParseExact(doc.Descendants("cachedUntil").First().Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); return(new CachedData <IDictionary <long, FactionWarfareOccupancy> > { Value = fwStats.ToDictionary(x => x.SolarSystemId, y => y), CachedUntil = cachedUntil }); }
private static CachedData <IDictionary <long, SovEntry> > GetSovereignitySync() { var doc = XDocumentWebRequester.RequestCcpApiXmlDocument( "https://api.eveonline.com/map/Sovereignty.xml.aspx"); var sovEntries = doc.Descendants("row") .Select( x => new SovEntry { SolarSystemID = x.GetLongAttributeValue("solarSystemID"), AllianceID = x.GetLongAttributeValue("allianceID"), FactionID = x.GetLongAttributeValue("factionID") }) .ToList(); var cachedUntil = DateTime.ParseExact(doc.Descendants("cachedUntil").First().Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); return(new CachedData <IDictionary <long, SovEntry> > { Value = sovEntries.ToDictionary(x => x.SolarSystemID, x => x), CachedUntil = cachedUntil }); }
private static XDocument RequestCcpApiXmlDocument(string[] characterIds) { var requestUrl = "https://api.eveonline.com/eve/CharacterAffiliation.xml.aspx?ids=" + string.Join(",", characterIds); return(XDocumentWebRequester.RequestCcpApiXmlDocument(requestUrl)); }
private static XDocument RetrieveCharacterIdsDocument(IEnumerable <string> unknownNames) { const string REQUEST_URL = "https://api.eveonline.com/eve/CharacterID.xml.aspx"; return(XDocumentWebRequester.RequestCcpApiXmlDocumentPOST( REQUEST_URL, new Dictionary <string, string> { { "names", ToNamesUrlParameterValue(unknownNames) } })); }
private static CachedData <IDictionary <long, int> > GetJumpsBySystemIdInternal() { var doc = XDocumentWebRequester.RequestCcpApiXmlDocument( "https://api.eveonline.com/map/Jumps.xml.aspx"); var jumpsBySystem = doc.Descendants("row").ToDictionary(x => x.GetLongAttributeValue("solarSystemID"), x => x.GetIntAttributeValue("shipJumps")); var cachedUntil = DateTime.ParseExact(doc.Descendants("cachedUntil").First().Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); return(new CachedData <IDictionary <long, int> > { Value = jumpsBySystem, CachedUntil = cachedUntil }); }
private XDocument RetrieveCharacterXDocument() { var requestUrl = "https://api.eveonline.com/eve/CharacterInfo.xml.aspx?characterID=" + _charId; return(XDocumentWebRequester.RequestCcpApiXmlDocument(requestUrl)); }