Octgn data access

kellyelton edited this page Mar 14, 2013 · 11 revisions

OCTGN data access has been put in an assembly that you may use in your own .NET projects.

This is depreciated. Please stay tuned for more information.

Required files

  • Octgn.Data.dll the data access .NET assembly.
  • System.Data.SQLite.dll database assembly.

How to use

Reference those files from your project. You never have to access the VistaDB API directly, it's only used by Octgn.Data.dll internally. Everything is inside the Octgn.Data namespace.

To start accessing OCTGN data, you must create a GamesRepository instance.

GamesRepository lets you install new games into the OCTGN repository, and browse the one already installed.

This collection contains Game instances, which expose important game properties (but not the whole definition, unfortunately).

This library also lets you load and save decks, represented by the Deck class. The Load static method let you load an existing deck (you have to provide either the specific game this is for, or an instance of GameRepository and it will look for a matching game in the repository. A new deck can be created simply with the constructor, which takes a Game instance.

If you edit the deck, you may save it with the Save method.

Example:

// This will get the card back image for whichever card
// game was installed first.
private void Button1_Click(object sender, RoutedEventArgs e)
{
	GamesRepository repo = new Octgn.Data.GamesRepository();
	Game myGame = repo.Games[0]; 
	BitmapImage src = new BitmapImage();
	src.BeginInit();
	src.UriSource = myGame.GetCardBackUri();
	src.CacheOption = BitmapCacheOption.OnLoad;
	src.EndInit();
	Image1.Source = src;
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.