Usage

The following document will describe basic usage of the library. It is recommended that you look at the demo project in the source file for a more detailed look at how LibWowAPI operates. There is also help documentation available which fully documents that API.

Be sure to include a reference to LibWowAPI in your class with the following declaration:
VB.Net:
Imports roncliProductions.LibWowAPI
C#:
using roncliProductions.LibWowAPI;


There are several shared properties that you can set prior to using the library:
VB.Net
' For Battle.Net API authentication
WowAPIData.PublicKey = "ABCDEFGHIJKL"
WowAPIData.PrivateKey = "MNOPQRSTUVWX"
' Supporting all regions and languages currently supported by the API
WowAPIData.Region = Internationalization.Region.NorthAmerica
WowAPIData.Language = Internationalization.Language.EnglishUS
' Identify your application to Blizzard
WowAPIData.Application = "My LibWowAPI Application"
WowAPIData.ApplicationURL = "http://www.mywowsite.com"
C#:
// For Battle.Net API authentication
WowAPIData.PublicKey = "ABCDEFGHIJKL";
WowAPIData.PrivateKey = "MNOPQRSTUVWX";
// Supporting all regions and languages currently supported by the API
WowAPIData.Region = Internationalization.Region.NorthAmerica;
WowAPIData.Language = Internationalization.Language.EnglishUS;
// Identify your application to Blizzard
WowAPIData.Application = "My LibWowAPI Application";
WowAPIData.ApplicationURL = "http://www.mywowsite.com";


To use the library, first you instantiate an instance of the class you want to use.
VB.Net:
Dim cCharacter As New Character.CharacterProfile()
C#:
Character cCharacter = new Character.CharacterProfile();


Next, you set options you want to use.
VB.Net:
cCharacter.Options.Realm = "Korialstrasz"
cCharacter.Options.Name = "Roncli"
cCharacter.Options.Items = True
cCharacter.Options.Talents = True
cCharacter.Options.Progression = True
C#:
cCharacter.Options.Realm = "Korialstrasz";
cCharacter.Options.Name = "Roncli";
cCharacter.Options.Items = true;
cCharacter.Options.Talents = true;
cCharacter.Options.Progression = true;


Then, you load the data from the API.
VB.Net:
cCharacter.Load()
C#:
cCharacter.Load();


Finally, you retrieve the information from the object.
VB.Net:
Dim intAchievementPoints As Integer = cCharacter.Character.AchievementPoints
Dim iHeadItem as Character.Item = cCharacter.Character.Items.Head
C#:
int intAchievementPoints = cCharacter.Character.AchievementPoints;
Character.Item iHeadItem = cCharacter.Character.Items.Head;


Some properties are made of collections, which allows for using LINQ.
VB.Net:
Dim varSelectedTalents = (From t in cCharacter.Talents Where t.Selected)
Dim varClearedHeroicRaids = (From r in cCharacter.Progression.Raids Where r.Heroic = Progress.Cleared)
C#:
var varSelectedTalents = (from t in cCharacter.Talents where t.Selected select t);
var varClearedHeroicRaids = (from r in cCharacter.Progression.Raids where r.Heroic == Progress.Cleared select r);

Last edited Aug 28, 2011 at 12:35 AM by roncli, version 1

Comments

No comments yet.