This project is read-only.

The DataManger

The whole library centres around one class and it‘s corresponding interface: DataManger and IDataManager. This class creates and manages the data providers for the different api nodes.
To query the api you first have to create a new instance of the DataManger class like this:

using GW2DotNET.V1;
IDataManger dataManger = new DataManager();

With this you create an instance and it‘s default values. If you don‘t want to query the api in English you have to pass the language (e.g. Languages.Fr) to the constructor, like this:

using GW2DotNET.V1;
IDataManger dataManagerFrench = new DataManger(Language.Fr);

If you are not satisfied with the language choice you made during creation you can change it afterwards by setting the Language property (warning changing the language will clear the cache globally).

dataManger. Language = Language.De

Now we have an instance of the DataManger and we want to check which is the latest build of the game. This is important for the cache (which we will later talk about). To get the build of the game you can access the Build property like this:

int build = dataManger.Build;

This however will not query the server for the version it just uses the cached build. If you want to query the server for a new build you have to call the GetLatestBuild method:

int latestBuild = dataManger.GetLatestBuild();

The method will query the server for the latest build return it and also store it in the Build property.

The last but not least part of the DataManger is the ClearCache method. The cache is used to cut on load heavy server query's, like the items node where each item has to be queried one at a time. This sometimes results in minute long operations. The cache is used to give the you the user the ability to get the details without querying the server too much. Each data provider (except world versus world) has it‘s own cache which can be cleared on it‘s own or globally via the ClearCache method:


As previously said each data provider has it‘s own cache and just as each cache can be cleared on it‘s own each cache can be turned on or off on it‘s own. To turn on or off a cache, just set the BypassCache property to true or false like this:

dataManger.DynamicEventsData.BypassCache = true;

You also can write the cache to disk by calling the WriteCacheToDisk method on the data providers:


This method will save the cache to the file system on the specified path. Default is „AppData/Local/GW2.NET“, however you can change the path by calling the ChangeSavePath method. Just specify the new path as a string. You can either omit the GW2.NET folder name or not. The method will recognize if you do it nor not and if needed add the folder name if needed.

string newSavePath = @„C:\My Awesome Sub Folder\Another Awesome Sub Folder“;
// This also works and will store it in the same location as the path above.
//string newSavePath = @„C:\My Awesome Sub Folder\Another Awesome Sub Folder\GW2.NET“;

If you change the Save Path the method will move the whole cache to the new location, it will not however, overwrite existing files. If you want to do that you have to specify it in the methods parameters:

string newSavePath = @„C:\My Awesome Sub Folder\Another Awesome Sub Folder“;
bool overwriteExistingFiles = true;
dataManager.ChangeSavePath(newSavePath, overwriteExistingFiles);

If you just want the save path to display it or use it in other location you can do this by calling the read-only SavePath property:

string savePath = dataManager.SavePath;

This concludes this topic. Since every data provider is slightly different each one will have it‘s own short article.


Here is a full (console) example on how to use the data manger class:

using GW2DotNET.V1;

public class Program
	private IDataManager dataManger;

	static void Main(string[] args)
		// Create a new instance.
		this.dataManager = new DataManger(Language.De);
		// Get the build
		int build = this.dataManger.Build;

		// Oh my goodness gracious,
                // the build is pre-searing, we need to update it!
		build = this.dataManger.GetLatestBuild();

		// Since the user probably wants 
                // to know what the build is, print it to him
		Console.WriteLine(„Latest Build: {0}“, build);

Last edited Feb 9, 2014 at 3:55 PM by Ruhrpottpatriot, version 3