Skip to content
MagnusVortex edited this page Mar 4, 2012 · 11 revisions

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

Required files

  • Octgn.Data.dll the data access .NET assembly.
  • VistaDB.NET20.dll the database component used by previous assembly (VistaDB). <Note: This is changing soon. A new dll will be needed to access the new database (probably SQLite3)>

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. The constructor takes the path to the OCTGN games folder as a parameter. (OCTGN doesn't save anything in the registry, so you'll have to ask your user to provide this path.)

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

This collection contains Game instances, which expose most important game properties (but not the whole definition, unfortunately). To access advanced information (like cards or sets) you must first make a call to OpenDatabase(bool readonly). Don't forget to call CloseDatabase() in the end.

Once the database is open, you can read the sets, cards and markers.

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.