当前位置: 首页>>代码示例>>C#>>正文


C# Session.Authenticate方法代码示例

本文整理汇总了C#中Session.Authenticate方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Authenticate方法的具体用法?C# Session.Authenticate怎么用?C# Session.Authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.Authenticate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Authenticate

        public bool Authenticate(string user, string password)
        {
            try
            {
                _session = new Session(API_KEY, API_SECRET);

                string md5password = Utilities.MD5(password);

                _session.Authenticate(user, md5password);
                if (_session.Authenticated)
                {
                    if (OnLogin != null)
                        OnLogin(this, EventArgs.Empty);
                    _lfmUser = new User(user, _session);

                    pollTimer.Change(0, Timeout.Infinite);
                    return true;
                }
                else
                {
                    if (OnLoginFailed != null)
                        OnLoginFailed(this, EventArgs.Empty);
                    return false;
                }
            }
            catch {
                Debug.Print("Last.FM authentication error");
                return false;
            }
        }
开发者ID:jfarre20,项目名称:Ubiquitous,代码行数:30,代码来源:ULastFm.cs

示例2: LastProfile

 //private Session session;
 //private Lastfm.Scrobbling.Connection connection;
 //private Lastfm.Scrobbling.ScrobbleManager manager;
 public LastProfile(string username, string password)
 {
     this.username = username;
     this.password = password;
     session = new Session("60d35bf7777d870ec958a21872bacb24", "099158e5216ad77239be5e0a2228cf04");
     session.Authenticate(this.username, Lastfm.Utilities.md5(this.password));
     connection = new Lastfm.Scrobbling.Connection("tst", "0.6", this.username, session);
     manager = new Lastfm.Scrobbling.ScrobbleManager(connection);
 }
开发者ID:andrewjswan,项目名称:youtube-fm-for-mediaportal,代码行数:12,代码来源:LastProfile.cs

示例3: LastfmService

    /// <summary>
    /// Constructs last.fm service object 
    /// assigning data from tag into local search
    /// tokens. A last.fm authenticated session
    /// is also setup based on user parameters and keys.
    /// </summary>
    /// <param name="tag">Song tag to search for</param>
    public LastfmService(File release, int maxMaxResults=20)
    {
      Trace.WriteLine("Initializing LastFM Session");
      Metadata metadata = release.Metadata;

      // Initialize search tokens
      Tokens = new Dictionary<string, string>();
      Tokens.Add("artist", metadata.Artist);
      Tokens.Add("release", metadata.Release);
      Tokens.Add("title", metadata.Title);

      MaxResults = maxMaxResults;

      // Initialize lastfm session
      session = new Session(key, secret);
      session.Authenticate(username, Lastfm.Utilities.md5(passwd));
      Trace.WriteLine("Session established with key: " + session.SessionKey);
    }
开发者ID:hannuraina,项目名称:tag,代码行数:25,代码来源:LastfmService.cs

示例4: GetSession

        private static Session GetSession(Configuration configuration)
        {
            var username = configuration.Username;
            var password = configuration.Password;

            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                throw new AuthenticationException();
            }

            const string API_KEY = "fe136e7517c55e3d9f7aa295c2b02a72";
            const string API_SECRET = "433cdcd4e96914dbcd71f176654e3bb3";

            var session = new Session(API_KEY, API_SECRET);
            session.Authenticate(username, password);

            return session;
        }
开发者ID:moby41,项目名称:last-horizonte,代码行数:18,代码来源:RadioScrobbler.cs


注:本文中的Session.Authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。