Пример #1
0
        protected FlickrManager LoadToken()
        {
            var         mgr = new FlickrManager();
            AccessToken token;

            try
            {
                using (var stream = KeyFile.OpenRead())
                {
                    token = stream.Load <AccessToken>();
                }
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException($"Error loading token '{KeyFile.FullName}'. {ex.Message}");
            }
            try
            {
                mgr.ApplyToken(token);
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException($"Supplied token is invalid. {ex.Message}");
            }
            return(mgr);
        }