SC2Ranks API Library [Obsolete]
SC2Ranks is out of service. This library is no longer useful.
![]() |
|
Developers Last Update Started Language Tools License |
Kevin Gardthausen 2014-10-05 2011-08-12 VB.Net 4.0 Visual Studio 2012 GNU GPL v3 |
Visual Basic .NET 4.0 implementation of the SC2Ranks API with optional request caching.
Project includes test project. Also works with Mono (v3.3.0+) framework.
What is SC2Ranks?
SC2Ranks is a site aggregating StarCraft II player statistics from around the world.
Support
- Home Page: https://www.nugardt.com/open-source/sc2ranks-api/
- Code: https://github.com/NuGardt/sc2ranks-api
- SC2Ranks:
http://www.sc2ranks.com/ - Issue Tracking: https://jira.nugardt.com/browse/NSA
- Create issue via e-Mail: [email protected]
- E-mail: [email protected]
- Twitter: https://www.twitter.com/NuGardt
- Facebook: https://www.facebook.com/NuGardt
Open source
Download the source at https://github.com/NuGardt/sc2ranks-api
Subversion (SVN):
1 |
svn checkout https://github.com/NuGardt/sc2ranks-api |
Git:
1 |
git clone https://github.com/NuGardt/sc2ranks-api.git |
Created in Microsoft Visual Studio 2012 with Visual Basic .NET 4.0.
Download
Usage
Library is thread safe. Original library is signed by NuGardt.
Creating an instance
1 2 3 4 5 6 7 8 9 10 |
Dim RankService As Sc2RanksService Dim CacheStream As System.IO.Stream Dim CacheConfig As New SC2Ranks.API.CacheConfig Dim Ex As System.Exception Ex = SC2Ranks.API.Sc2RanksService.CreateInstance(ApiKey:="U8tHgfnCy2VViNXPPkW7ZED0wB2VNQt9nBNI", Instance:=RankService, CacheStream:=CacheStream, CacheConfig:=CacheConfig, IgnoreFaultCacheStream:=False) |
Creates an instance of the Sc2RanksService. It takes three parameters.
* ApiKey: Your private SC2Ranks API key (http://www.sc2ranks.com/usercp/api)).
* Instance: Reference. Contains the instance if Ex is Nothing.
* CacheStream: Optional. Read/write stream for cache data.
* CacheConfig: Optional. Caching durations for all API calls.
* IgnoreFaultCacheStream: Optional, default False. True: If the cache stream is not readable not error will be returned. False: If the cache stream is not readable an error will be returned and no instance will be created.
Returns System.Exception if unsuccessful.
Calling a method (Sync)
1 2 3 4 5 6 7 8 |
Dim Ex As System.Exception Ex = RankService.GetCharacter(Region:=eSc2RanksRegion.EU, BattleNetID:=1770249, Result:=ResultInstance, IgnoreCache:=False) If (Ex IsNot Nothing) Then Call Trace.WriteLine(Ex.ToString) |
Calls RankService.GetBasePlayerByBattleNetID. Takes multiple parameters depending on method. IgnoreCache and Result are always present.
* IgnoreCache: Optional, default False. If cache data is available then the cached data will be used and SC2Ranks will not be contacted.
* Result: Reference. Contains the result if Ex is Nothing.
Returns System.Exception if unsuccessful.
Calling a method (Async)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Private Sub Start() Dim AsyncResult As System.IAsyncResult AsyncResult = RankService.GetCharacterBegin(Key:="SomeKey", Region:=eSc2RanksRegion.EU, BattleNetID:=1770249, Callback:=AddressOf MyCallback, IgnoreCache:=False) End Sub Private Sub MyCallback(ByVal Result As IAsyncResult) Dim Ex As Exception Dim Response As GetBasePlayerResult = Nothing Dim Key As Object = Nothing 'Will contain "SomeKey" after the End call Ex = RankService.GetCharacterEnd(Result:=Result, Key:=Key, Response:=Response) 'Your code to do something with the result or exception... End Sub |
Calls RankService.GetCharacterBegin without waiting for the result. When the result is available the callback will be called.
* Key: Can be nothing. Useful it for tracking calls.
* Callback: Will be called when the result is available.a
Version History
- v2.0.3.0 (SVN r90)
- NSA-9: Scores can be Null.
- Updated help file.
License
NuGardt SC2Ranks API
Copyright (C) 2011-2015 NuGardt Software
https://www.nugardt.com
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Leave a Reply
You must be logged in to post a comment.