Пример #1
0
        /// <summary>
        /// Create a new EveLogin and add a token with scope.
        /// </summary>
        /// <param name="scope"></param>
        /// <param name="clientID"></param>
        /// <param name="callback"></param>
        /// <param name="client"></param>
        /// <returns></returns>
        public static async Task <EveLogin> Login(Scope scope, string clientID, string callback, HttpClient client = default)
        {
            EveLogin login = new EveLogin(clientID, callback, client);
            await login.AddToken(scope);

            return(login);
        }
Пример #2
0
        public static async Task <EveLogin> FromJson(string json, HttpClient client = default)
        {
            (Dictionary <string, List <string> > eveLoginSave, string clientID, string callback)loaded;
            loaded = JsonConvert.DeserializeObject <(Dictionary <string, List <string> >, string, string)>(json);

            EveLogin login = new EveLogin(loaded.clientID, loaded.callback, client);

            foreach (var user in loaded.eveLoginSave)
            {
                List <IToken> tokens = new List <IToken>();

                foreach (var token in user.Value)
                {
                    tokens.Add(await EveAuthentication.FromJson(token, Client));
                }

                login.userTokens.Add(user.Key, tokens);
            }

            return(login);
        }