Using the provided ResponseCache.bin

The provided ResponseCache contains most of the items and recipes along with item icons/images. The intent is to provide an updated ResponseCache along with each release.

To use the response cache, simply put it in the root directory of your application or use the ResponseCache.Cache.Load(string filename) method to load a specific cache file.

The provided response cache also provides 2 dictionaries to make item and/or recipe searching very fast and easy.

Below shows usage to retrieve a dictionary of items and recipes.

Getting the Item and Recipe dictionaries

To use:
// Recipe Dictionary keyed by recipe id
EntryDictionary<int,RecipeDetailsEntry> Recipes = ResponseCache.Cache.Get("RecipeDictionary");

// Item dictionary keyed by item id
EntryDictionary<int,ItemDetailsEntry> Items = ResponseCache.Cache.Get("ItemsDictionary");

Saving the cache and Dictionaries

Anytime an item is retrieved, it is advised to add it to the dictionary. The dictionary can then be added back to the Cache for permanent storage as shown below:
ResponseCache.Cache.Set("RecipeDictionary", Recipes);
ResponseCache.Cache.Set("ItemsDictionary", Items);
ResponseCache.Cache.Save();

How to search the dictionaries:

Use LINQ! LINQ is awesome for doing complex searches over an array.
Check out Getting Started for more details on searching the items dictionary using LINQ.

Last edited Sep 17, 2013 at 1:35 AM by cneal13x, version 2

Comments

No comments yet.