michidk / TwitchCSharp

Twitch C# Wrapper for the Twitch v3 REST API
Apache License 2.0
43 stars 12 forks source link

TwitchCSharp for VS2008 #1

Closed lemoniscool closed 7 years ago

lemoniscool commented 9 years ago

Hi! I've tried to compile your wrapper for net35 to use it in VS2008 but either im missing something or your code simply isnt compatible for net35 .. i cant tell exactly as i've never really used VS2012 or net45 Before you ask, yes i set the nuget config to use net35 version of the required libs and set the project to net35 too, but i still get linker warnings naming something about net45 and net35 ..

Maybe you could add a release for .net 3.5?

Thanks in advance

lemoniscool commented 9 years ago

okay nevermind i managed to fix those linker warnings and most of the errors, but now there are 3 other errors related to methods or overloaded methods which are available in higher net versions only:

1 - "String" has no method called "IsNullOrWhitespace" - TwitchAuthenticatedClient.cs line 23 2 - "System.Type" has no definition for "GetCustomAttribute" - TwitchListConverter.cs line 23 3 - No overload for the method "SetValue" takes 2 arguments - TwitchListConverter.cs line 34

i could write an extension method for the first one and the fix for the third one is pretty easy (just add null as third parameter because its optional) but the second one .... no clue i dont know that method at all :/

lemoniscool commented 9 years ago

okay so with the help of a kind guy from stackoverflow i got an extension method for the second error too. if you want the updated code (compatible with all versions from net35 and above) tell me!

michidk commented 9 years ago

Hey, first of all sorry for the inconveniences, i didn't even know that the wrapper wasn't compatible with net 3.5. Yeah it would be awesome, if you could share the updated code!

lemoniscool commented 9 years ago

im not familiar with forking etc on git repos so ill just post my additions here..

first off, in your project debug settings add the following commandline parameter: http://pastebin.com/ZkkpT85v

after that create a new folder in the project view named "Extensions" and add 2 new classes to it: StringExt.cs : http://pastebin.com/iDMf119C TypeExt.cs : http://pastebin.com/0AGEMwNN

after that edit the following classes accordingly: TwitchListConverter.cs : http://pastebin.com/wmrBaWcg TwitchAuthenticatedClient.cs : http://pastebin.com/Cqj3BnNG

thats about it, it should compile for net35 without problems if you set the linker to use net35 versions of Newtonsoft.Json and RestSharp

lemoniscool commented 9 years ago

Another thing that just came to my mind, i "fixed" the 2 CS0108 warnings you had in the code ('member1' hides inherited member 'member2'. Use the new keyword if hiding was intended.) by, as the warning said, using the new keyword in front of those members. I did this while i was figuring out what was causing the problems with net35. here are the changed classes:

Video.cs line 17: http://pastebin.com/f6BCFv12 TwitchAuthenticatedClient.cs line 210, see pastebin link for this class form my last comment

i know the compiler does it anyways unless you change the code to not hide those members anymore, but i like if projects compile without warnings ^^

michidk commented 9 years ago

yeah, thank you for publishing your fixes, i definitely going to implement them.

michidk commented 9 years ago

whoops.. closed the issue by accident

michidk commented 8 years ago

It would be awesome, if someone could create a pull request out of this!

michidk commented 7 years ago

Just revisited TwitchCSharp.

This is not about your Visual Studio version but about the C# version / language level. Is there any reason to use an older C# version? I just read that VS2008 supports C# 3.0, 4.0 and 5.0. e.g. String.IsNullOrWhiteSpace was added in C# 4.0.

If so let me know and I will think about adding support for older versions.

Cheers, Michi