Anyone working on a Win8 WinRT version of this?

Oct 25, 2011 at 2:14 AM

I was wondering if work was underway to get this library working for WinRT projects ?

Mainly for the C# / XAML world ?!

Coordinator
Oct 25, 2011 at 8:15 AM

I've looked at it. It shouldn't be too bad as the core complexity in the FlickrNet library is done using XmlTextReader, which is still part of the Metro profile.

The cryptography bit needs changing as System.Cryptography has gone, but I've already worked that out.

So the rest is probably just changing all the async calls over to use the async/await keywords, which will be quite a bit of work but not that difficult.

However I'm in no rush to get it done I'm afraid, as I don't have the bandwidth at the moment. If someone else wants to look into it then feel free.

Sam

Coordinator
Oct 25, 2011 at 11:09 AM

For reference, the code to do the HMAC-SHA1 encryption is as follows:

using Windows.Security.Cryptography;
using Windows.Security.Cryptography.Core;

...

public static string Sha1Encrypt(string baseString, string keyString)
{
    var crypt = MacAlgorithmProvider.OpenAlgorithm("HMAC_SHA1");
    var buffer = CryptographicBuffer.ConvertStringToBinary(baseString, BinaryStringEncoding.Utf8);
    var keyBuffer = CryptographicBuffer.ConvertStringToBinary(keyString, BinaryStringEncoding.Utf8);
    var key = crypt.CreateKey(keyBuffer);

    var sigBuffer = CryptographicEngine.Sign(key, buffer);
    string signature = CryptographicBuffer.EncodeToBase64String(sigBuffer);
    return signature;
}

Oct 30, 2011 at 9:55 AM

I created a WinRT working version of your FlickrNet project and when the time comes (when Windows 8 reaches beta or more stable state) I'll be happy to contribute to your project assuming you want help :)

http://advertboy.wordpress.com/2011/10/30/flickrnet-library-for-winrt/

 

Coordinator
Nov 1, 2011 at 9:39 AM

That's great, thanks for that. So basically the Silverlight version works without too much work, at least for normal methods (I notice you had to comment out some unsupported lines in the upload code so that probably wont work).

For a proper version I'll definitely want to look at supporting the async/await keywords, but for now your version is a great start for anyone wanting to do some work in the mean time.

Thanks

Sam

Nov 2, 2011 at 1:15 PM

sry to keep updating this BUT thought I'd share my findings regarding using FlickrNET in WinRT world..

I just updated the WinRT library to use the latest FlickrNet code which has OAuth bits in it ... works great :)

http://advertboy.wordpress.com/2011/11/02/flickrwinrt-library-now-uses-oauth/

My next goal is to use WebAuthenticationBroker to make the Auth URL call so the user doesn't need to copy/paste from flickr etc. Thats a very tedious process to manually do especially when on a tablet with only touch.

Also i'm looking at turning the output type from "Class Library" to "WinMD" so that I can use this across XAML/C++ and HTML/JS apps. I'm finding very interesting things, like 730 errors that need addressing :) .. Looks like i need to refactor ALOT to make it a WinMD library :p  [this will be a very interesting weekend]

Will keep you posted on my adventures..

 

 

 

Coordinator
Nov 2, 2011 at 4:23 PM

Yeah, for that we're gonna need a complete rewrite, something that I don't think will be worth it till at least Beta. XmlReader isn't a WinRT type, so it will require a complete rewrite of the parsing logic (which I had hoped to avoid).

Other errors include use of Collections<> generic type as well as System.DateTime which bizarrely isn't supported (but DateTimeOffset is?)

Sam