Beispiel #1
0
        public Task <EveServiceResponse <ServerStatus> > ServerStatusAsync(ResponseMode responseMode = ResponseMode.Normal)
        {
            const string MethodPath     = "{0}/ServerStatus.xml.aspx";
            const string CacheKeyFormat = "ServerStatus";

            string cacheKey = CacheKeyFormat.FormatInvariant();

            IDictionary <string, string> apiParams = new Dictionary <string, string>();

            return(GetServiceResponseAsync(null, null, 0, MethodPath.FormatInvariant(RequestPrefix), apiParams, cacheKey,
                                           ApiConstants.SixtyMinuteCache, responseMode, ParseServerStatusResponse));
        }
Beispiel #2
0
        /// <summary>The conquerable station list async.</summary>
        /// <param name="responseMode">The response mode.</param>
        /// <returns>The <see cref="Task" />.</returns>
        public Task <EveServiceResponse <IEnumerable <ConquerableStation> > > ConquerableStationListAsync(
            ResponseMode responseMode = ResponseMode.Normal)
        {
            const string MethodPath     = "{0}/ConquerableStationList.xml.aspx";
            const string CacheKeyFormat = "ConquerableStationList";

            string cacheKey = CacheKeyFormat.FormatInvariant();

            IDictionary <string, string> apiParams = new Dictionary <string, string>();

            return(GetServiceResponseAsync(null, null, 0, MethodPath.FormatInvariant(RequestPrefix), apiParams, cacheKey,
                                           ApiConstants.SixtyMinuteCache, responseMode, ParseConquerableStationListResponse));
        }
Beispiel #3
0
        private void CreateBreakpoints()
        {
            foreach (var assembly in configuration.assemblies)
            {
                var assemblySymbols = shell.PdbSymbolCache[assembly.path];
                var methodLocator   = shell.GetMethodLocator(assembly.path);

                foreach (var methodConfiguration in assembly.methods)
                {
                    var methodInfo = methodLocator.GetMethod(methodConfiguration);
                    var methodPath = MethodPath.Read(methodConfiguration.name);

                    if (methodInfo != null)
                    {
                        var methodSymbols = assemblySymbols.methods.Where(s => MethodPath.Read(s.name).Type == methodPath.Type &&
                                                                          MethodPath.Read(s.name).Method == methodPath.Method && Convert.ToInt32(s.token, 16) == methodInfo.MetadataToken).Single();

                        var bpDetails = new BreakpointDetails {
                            Method = methodConfiguration, MethodInfo = methodInfo
                        };

                        //Create method entry break point.
                        var entrySequencePoint = methodSymbols.sequencePoints.First(p => !p.hidden);
                        var methodEntryFile    = assemblySymbols.sourceFiles.Where(s => s.id == entrySequencePoint.sourceId).Single();
                        var bpEntry            = CreateBreakpointAtPosition(methodEntryFile.url + ":" + entrySequencePoint.startRow);
                        var bpEntryInfo        = new BreakpointMetadata {
                            Reason = BreakpointReason.MethodEntry, Details = bpDetails
                        };
                        breakpointMetadataList[bpEntry] = bpEntryInfo;
                        shell.WriteLine(bpEntry.ToString());

                        //Create method exit break point.
                        var exitSequencePoint = methodSymbols.sequencePoints.Last();
                        var methodExitFile    = assemblySymbols.sourceFiles.Where(s => s.id == exitSequencePoint.sourceId).Single();
                        var bpExit            = CreateBreakpointAtPosition(methodExitFile.url + ":" + exitSequencePoint.startRow);
                        var bpExitInfo        = new BreakpointMetadata {
                            Reason = BreakpointReason.MethodExit, Details = bpDetails
                        };
                        breakpointMetadataList[bpExit] = bpExitInfo;
                        shell.WriteLine(bpExit.ToString());

                        shell.WriteLine("Monitoring {0}", methodConfiguration.name);
                    }
                    else
                    {
                        shell.WriteLine("WARNING: Unresolved {0}", methodConfiguration.name);
                    }
                }
            }
        }
Beispiel #4
0
        /// <summary>The character info async.</summary>
        /// <param name="characterId">The character id.</param>
        /// <param name="responseMode">The response Mode.</param>
        /// <returns>The <see cref="Task" />.</returns>
        public Task <EveServiceResponse <CharacterInfo> > CharacterInfoAsync(int characterId,
                                                                             ResponseMode responseMode = ResponseMode.Normal)
        {
            Guard.Ensure(characterId > 0);
            const string MethodPath     = "{0}/CharacterInfo.xml.aspx";
            const string CacheKeyFormat = "Eve_CharacterInfo{0}";

            string cacheKey = CacheKeyFormat.FormatInvariant(characterId);
            IDictionary <string, string> apiParams = new Dictionary <string, string>();

            apiParams.Add(ApiConstants.CharacterId, characterId.ToInvariantString());

            return(GetServiceResponseAsync(null, null, 0, MethodPath.FormatInvariant(RequestPrefix), apiParams, cacheKey,
                                           ApiConstants.SixtyMinuteCache, responseMode, ParseCharacterInfoResult));
        }
Beispiel #5
0
        /// <summary>The upcoming calendar events.</summary>
        /// <param name="keyId">The key id.</param>
        /// <param name="vCode">The v code.</param>
        /// <param name="characterId">The character id.</param>
        /// <param name="responseMode">The response Mode.</param>
        /// <returns>The <see cref="Task" />.</returns>
        public Task <EveServiceResponse <IEnumerable <UpcomingCalendarEvent> > > UpcomingCalendarEvents(string keyId,
                                                                                                        string vCode, long characterId, ResponseMode responseMode = ResponseMode.Normal)
        {
            Guard.Ensure(!keyId.IsNullOrWhiteSpace());
            Guard.Ensure(!vCode.IsNullOrWhiteSpace());
            Guard.Ensure(characterId > 0);

            const string MethodPath     = "{0}/UpcomingCalendarEvents.xml.aspx";
            const string CacheKeyFormat = "UpcomingCalendarEvents{0}_{1}";

            string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId);

            return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), null,
                                           cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ProcessUpcomingCalendarEventsResponse));
        }
Beispiel #6
0
        /// <summary>Retrieves the Character Sheet data from the Eve web service.</summary>
        /// <param name="keyId">API Key ID to query</param>
        /// <param name="vCode">The Verification Code for this ID</param>
        /// <param name="characterId">Character to query.</param>
        /// <param name="responseMode">The response Mode.</param>
        /// <returns>The given character's data.</returns>
        public Task <EveServiceResponse <CharacterData> > CharacterSheetAsync(string keyId, string vCode, long characterId,
                                                                              ResponseMode responseMode = ResponseMode.Normal)
        {
            Guard.Ensure(!keyId.IsNullOrWhiteSpace());
            Guard.Ensure(!vCode.IsNullOrWhiteSpace());
            Guard.Ensure(characterId > 0);

            const string MethodPath     = "/char/CharacterSheet.xml.aspx";
            const string CacheKeyFormat = "CharacterSheet{0}_{1}";

            string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId);

            return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), null,
                                           cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ParseCharacterSheetResponse));
        }
Beispiel #7
0
        /// <summary>Retrieves the collection of mail message headers from the eve web service</summary>
        /// <param name="keyId">API Key ID to query</param>
        /// <param name="vCode">The Verification Code for this ID</param>
        /// <param name="characterId">Character to query.</param>
        /// <param name="responseMode">The response Mode.</param>
        /// <returns>A collection of mail headers </returns>
        public Task <EveServiceResponse <IEnumerable <MailHeader> > > MailMessagesAsync(string keyId, string vCode,
                                                                                        int characterId, ResponseMode responseMode = ResponseMode.Normal)
        {
            Guard.Ensure(!keyId.IsNullOrWhiteSpace());
            Guard.Ensure(!vCode.IsNullOrWhiteSpace());
            Guard.Ensure(characterId > 0);

            const string MethodPath     = "{0}/MailMessages.xml.aspx";
            const string CacheKeyFormat = "CharacterMailMessages{0}_{1}";

            string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId);

            return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), null,
                                           cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ProcessMailMessagesResponse));
        }
Beispiel #8
0
        /// <summary>Calls the CalendarEventAttendees method on the Eve web service.</summary>
        /// <param name="keyId">API Key ID to query</param>
        /// <param name="vCode">The Verification Code for this ID</param>
        /// <param name="characterId">Character to query.</param>
        /// <param name="eventId">The eventID to query</param>
        /// <param name="responseMode"></param>
        /// <returns>A collection of attendees for the event.</returns>
        public Task <EveServiceResponse <IEnumerable <CalendarEventAttendee> > > CalendarEventAttendees(string keyId,
                                                                                                        string vCode, long characterId, int eventId, ResponseMode responseMode = ResponseMode.Normal)
        {
            Guard.Ensure(!keyId.IsNullOrWhiteSpace());
            Guard.Ensure(!vCode.IsNullOrWhiteSpace());
            Guard.Ensure(characterId > 0);

            const string MethodPath     = "{0}/CalendarEventAttendees.xml.aspx";
            const string CacheKeyFormat = "Calendar_EventAttendees{0}_{1}_{2}";

            string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId, eventId);

            IDictionary <string, string> apiParams = new Dictionary <string, string>();

            apiParams[ApiConstants.EventId] = eventId.ToInvariantString();

            return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), apiParams,
                                           cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ParseCalendarEventAttendeesResponse));
        }
Beispiel #9
0
        /// <summary>The notification texts.</summary>
        /// <param name="keyId">The key id.</param>
        /// <param name="vCode">The v code.</param>
        /// <param name="characterId">The character id.</param>
        /// <param name="notificationIds">The notification ids.</param>
        /// <param name="responseMode">The response Mode.</param>
        /// <returns>The <see cref="Task" />.</returns>
        public Task <EveServiceResponse <IEnumerable <NotificationText> > > NotificationTextsAsync(
            string keyId,
            string vCode,
            long characterId,
            IEnumerable <long> notificationIds,
            ResponseMode responseMode = ResponseMode.Normal)
        {
            Guard.Ensure(!keyId.IsNullOrWhiteSpace());
            Guard.Ensure(!vCode.IsNullOrWhiteSpace());
            Guard.Ensure(characterId > 0);

            const string MethodPath     = "{0}/NotificationTexts.xml.aspx";
            const string CacheKeyFormat = "NotificationTexts{0}_{1}_{2}";

            string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId, notificationIds.GetHashCode());
            IDictionary <string, string> apiParams = new Dictionary <string, string>();

            apiParams[ApiConstants.Ids] = string.Join(",", notificationIds.Select(id => id.ToInvariantString()));

            return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), apiParams,
                                           cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ProcessNotificationTextsResponse));
        }
Beispiel #10
0
        public Task <EveServiceResponse <CorporateData> > CorporationSheetAsync(string keyId, string vCode, int corpId = 0,
                                                                                ResponseMode responseMode = ResponseMode.Normal)
        {
            Guard.Ensure(!keyId.IsNullOrWhiteSpace());
            Guard.Ensure(!vCode.IsNullOrWhiteSpace());

            const string MethodPath     = "{0}/CorporationSheet.xml.aspx";
            const string CacheKeyFormat = "CorporationSheet{0}";

            string cacheKey = CacheKeyFormat.FormatInvariant(keyId,
                                                             corpId > 0 ? "_{0}".FormatInvariant(corpId) : string.Empty);

            IDictionary <string, string> apiParams = new Dictionary <string, string>();

            if (corpId > 0)
            {
                apiParams["corporationID"] = corpId.ToInvariantString();
            }

            return(GetServiceResponseAsync(keyId, vCode, 0, MethodPath.FormatInvariant(PathPrefix), apiParams, cacheKey,
                                           ApiConstants.SixtyMinuteCache, responseMode, ProcessCorporationSheetResponse));
        }
Beispiel #11
0
        /// <summary>Retrieves the mail bodies for given IDs</summary>
        /// <param name="keyId">API Key ID to query</param>
        /// <param name="vCode">The Verification Code for this ID</param>
        /// <param name="characterId">Character to query.</param>
        /// <param name="ids">The id values to get the mail bodies for</param>
        /// <param name="responseMode">The response Mode.</param>
        /// <returns>a collection of mail bodies</returns>
        public Task <EveServiceResponse <IEnumerable <MailBody> > > MailBodiesAsync(string keyId, string vCode,
                                                                                    long characterId, IEnumerable <int> ids, ResponseMode responseMode = ResponseMode.Normal)
        {
            Guard.Ensure(!keyId.IsNullOrWhiteSpace());
            Guard.Ensure(!vCode.IsNullOrWhiteSpace());
            Guard.Ensure(characterId > 0);
            Guard.Ensure(ids != null);
            Guard.Ensure(ids.Any());

            const string MethodPath     = "{0}/MailBodies.xml.aspx";
            const string CacheKeyFormat = "CharacterMailBodies{0}_{1}_{2}";

            // TODO: switch to using a hash value for making a unique key or a long batch of mail ids can cause a filename length issue.
            string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId,
                                                             string.Join("_", ids.Select(id => id.ToInvariantString())).GetHashCode());

            IDictionary <string, string> apiParams = new Dictionary <string, string>();

            apiParams[ApiConstants.Ids] = string.Join(",", ids.Select(id => id.ToInvariantString()));

            return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), apiParams,
                                           cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ProcessMailBodyResponse));
        }
Beispiel #12
0
        /// <summary>The character id async.</summary>
        /// <param name="names">The names.</param>
        /// <param name="responseMode">The response Mode.</param>
        /// <returns>The <see cref="Task" />.</returns>
        /// <exception cref="ArgumentException"></exception>
        public Task <EveServiceResponse <IEnumerable <CharacterName> > > CharacterIdAsync(IEnumerable <string> names,
                                                                                          ResponseMode responseMode = ResponseMode.Normal)
        {
            Guard.Ensure(names != null);

            List <string> checkedNames = names.Distinct().ToList(); // remove duplicates

            if (checkedNames.Count > 250 || checkedNames.Count < 1)
            {
                throw new ArgumentException("names must have a length of 250 or less and greater than 0.");
            }

            const string MethodPath     = "{0}/CharacterID.xml.aspx";
            const string CacheKeyFormat = "Eve_CharacterID{0}";
            const string paramName      = "names";
            string       cacheKey       = CacheKeyFormat.FormatInvariant(checkedNames.GetHashCode());

            IDictionary <string, string> apiParams = new Dictionary <string, string>();

            apiParams.Add(paramName, string.Join(",", checkedNames.Select(name => name)));

            return(GetServiceResponseAsync(null, null, 0, MethodPath.FormatInvariant(RequestPrefix), apiParams, cacheKey,
                                           ApiConstants.SixtyMinuteCache, responseMode, ParseCharacterNameResult));
        }