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


C# Flickr.OAuthCalculateAuthorizationUrl方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            Flickr flickr = new Flickr(FlickrKey.Key, FlickrKey.Secret);
            Auth auth = null;
            if (File.Exists("key.txt"))
            {
                using (var sr = new StreamReader("key.txt"))
                {
                    flickr.OAuthAccessToken = sr.ReadLine();
                    flickr.OAuthAccessTokenSecret = sr.ReadLine();
                }

            }

            if (!string.IsNullOrEmpty(flickr.OAuthAccessToken) &&
                 !string.IsNullOrEmpty(flickr.OAuthAccessTokenSecret))
            {
                auth = flickr.AuthOAuthCheckToken();
                int g = 56;
            }
            else
            {
                var requestToken = flickr.OAuthGetRequestToken("oob");
                var url = flickr.OAuthCalculateAuthorizationUrl(requestToken.Token, AuthLevel.Delete);
                Process.Start(url);

                var verifier = Console.ReadLine();

                OAuthAccessToken accessToken = flickr.OAuthGetAccessToken(requestToken, verifier);
                flickr.OAuthAccessToken = accessToken.Token;
                flickr.OAuthAccessTokenSecret = accessToken.TokenSecret;

                using (var sw = new StreamWriter("key.txt", false))
                {
                    sw.WriteLine(flickr.OAuthAccessToken);
                    sw.WriteLine(flickr.OAuthAccessTokenSecret);
                }

                auth = flickr.AuthOAuthCheckToken();
                int y = 56;
            }

            var baseFolder = @"D:\MyData\Camera Dumps\";

            var ex = new PhotoSearchExtras();
            var p = flickr.PhotosSearch(new PhotoSearchOptions(auth.User.UserId){Extras = PhotoSearchExtras.DateTaken | PhotoSearchExtras.PathAlias, });
            var sets = flickr.PhotosetsGetList();
            foreach (var set in sets)
            {
                var setDir = Path.Combine(baseFolder, set.Title);
                if ( Directory.Exists(setDir) )
                {
                    var setPhotos = flickr.PhotosetsGetPhotos(set.PhotosetId, PhotoSearchExtras.DateTaken | PhotoSearchExtras.MachineTags | PhotoSearchExtras.OriginalFormat | PhotoSearchExtras.DateUploaded);
                    foreach(var setPhoto in setPhotos)
                    {
                        if (Math.Abs((setPhoto.DateUploaded - setPhoto.DateTaken).TotalSeconds) < 60)
                        {
                            // Suspicious
                            int s = 56;
                        }

                        string ext = ".jpg";
                        if (setPhoto.OriginalFormat != "jpg")
                        {
                            int xxx = 56;
                        }
                        var filePath = Path.Combine(setDir, setPhoto.Title + ext);

                        if (!File.Exists(filePath))
                        {
                            // try mov
                            filePath = Path.Combine(setDir, setPhoto.Title + ".mov");

                            if (!File.Exists(filePath))
                            {
                                Console.WriteLine("not found " + filePath);
                            }
                        }

                        Console.WriteLine(filePath);
                        if ( File.Exists(filePath))
                        {
                            DateTime dateTaken;
                            if (!GetExifDateTaken(filePath, out dateTaken))
                            {
                                var fi = new FileInfo(filePath);
                                dateTaken = fi.LastWriteTime;
                            }

                            if (Math.Abs((dateTaken - setPhoto.DateTaken).TotalSeconds) > 10)
                            {
                                int hmmm = 56;
                            }
                        }
                    }
                }
            }
            //@"D:\MyData\Camera Dumps\"

            int z =  56;
//.........这里部分代码省略.........
开发者ID:jjbott,项目名称:SyncTool,代码行数:101,代码来源:Program.cs

示例2: GetAuthorizationObject

        public OAuthAuthorizationObject GetAuthorizationObject(string callbackUrl)
        {
            var flickr = new Flickr();
            var requestToken = flickr.OAuthGetRequestToken(callbackUrl);
            string authorizationUrl = flickr.OAuthCalculateAuthorizationUrl(requestToken.Token, AuthLevel.Read);

            return new OAuthAuthorizationObject(requestToken.TokenSecret, authorizationUrl);
        }
开发者ID:medvekoma,项目名称:portfotolio,代码行数:8,代码来源:FlickrOAuthProvider.cs

示例3: PageRootLoaded

        private async void PageRootLoaded(object sender, RoutedEventArgs e)
        {
            if (AccessToken != null) return;

            var f = new Flickr("dbc316af64fb77dae9140de64262da0a", "0781969a058a2745");
            var requestToken = await GetRequestToken();
            string output;
            var flickrUri = new Uri(f.OAuthCalculateAuthorizationUrl(requestToken.Token, AuthLevel.Delete));
            var webAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(
                                                    WebAuthenticationOptions.None,
                                                    flickrUri);

            if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)
            {
                output = webAuthenticationResult.ResponseData;
                AccessToken = await f.OAuthAccessTokenAsync(requestToken.Token, requestToken.TokenSecret, output);

                LoadDataSource(AccessToken);
            }
            else if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.ErrorHttp)
            {
                output = "HTTP Error returned by AuthenticateAsync() : " + webAuthenticationResult.ResponseErrorDetail.ToString();
            }
            else if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.UserCancel)
            {
                output = "Authentication process was cancelled by the user";
            } 
        }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:28,代码来源:GroupedItemsPage.xaml.cs


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