public EsiScopePresetAttribute(string Name, string Description = "", ScopeEntityType Scope = ScopeEntityType.Character) { this.DisplayName = Name; this.Description = Description; this.EntityScope = Scope; }
/// <summary> /// Parses all known scopes and excludes any scopes that add write access. /// </summary> /// <param name="entityScope"></param> /// <returns></returns> public static IEnumerable <string> GetReadOnlyScopes(ScopeEntityType entityScope) { var scopesRaw = ESH.GetScopes(entityScope); foreach (var scope in scopesRaw) { if (!scope.ToLower().Contains("write")) { yield return(scope); } } }
/// <summary> /// Get list of valid scopes based on entries in the EsiCharacterScopes and EsiCorporationScopes. /// </summary> /// <param name="entityType"></param> /// <returns></returns> public static IEnumerable <string> GetScopes(ScopeEntityType entityType) { if ((entityType == ScopeEntityType.Character) || (entityType == ScopeEntityType.Both)) { foreach (var p in typeof(EsiCharacterScopes).GetFields() .Where(a => a.IsDefined(typeof(ScopeStringAttribute), false))) { yield return((string)p.GetValue(null)); } } if ((entityType == ScopeEntityType.Corporation) || (entityType == ScopeEntityType.Both)) { var type = typeof(EsiCorporationScopes); foreach (var p in type.GetFields() .Where(a => a.IsDefined(typeof(ScopeStringAttribute), false))) { yield return((string)p.GetValue(null)); } } }