• Introduction
  • C# API
  • GraphQL API
  • Home
  • Blog
  • Docs
  • GitHub
  • Snowflake.Model.Game
  • IGameLibrary
Show / Hide Table of Contents
  • Snowflake.Configuration
    • ConfigurationCollection<T>
    • ConfigurationCollectionDescriptor<T>
    • ConfigurationOptionDescriptor
    • ConfigurationOptionType
    • ConfigurationSection<T>
    • ConfigurationSectionDescriptor<T>
    • ConfigurationValueCollection
    • IConfigurationCollection
    • IConfigurationCollection<T>
    • IConfigurationCollectionDescriptor
    • IConfigurationOptionDescriptor
    • IConfigurationProperty
    • IConfigurationSection
    • IConfigurationSection<T>
    • IConfigurationSectionDescriptor
    • IConfigurationTypeMapper
    • IConfigurationValue
    • IConfigurationValueCollection
    • ISelectionOptionDescriptor
    • PathType
    • SelectionOptionDescriptor
  • Snowflake.Configuration.Attributes
    • ConfigurationOptionAttribute
    • ConfigurationSectionAttribute
    • ConfigurationTargetAttribute
    • ConfigurationTargetMemberAttribute
    • CustomMetadataAttribute
    • InputTemplateAttribute
    • SelectionOptionAttribute
  • Snowflake.Configuration.Input
    • DictionaryInputMapping
    • IDeviceInputMapping
    • IInputOption
    • IInputSerializer
    • IInputTemplate
    • IInputTemplate<T>
    • InputConfigurationSection<T>
    • InputOption
    • InputOptionAttribute
    • InputTemplate<T>
  • Snowflake.Configuration.Interceptors
    • ConfigurationInterceptor
  • Snowflake.Configuration.Serialization
    • AbstractConfigurationNode<T>
    • BooleanConfigurationNode
    • ConfigurationTarget
    • ConfigurationTraversalContext
    • DecimalConfigurationNode
    • DeviceCapabilityElementConfigurationNode
    • EnumConfigurationNode
    • IAbstractConfigurationNode
    • IAbstractConfigurationNode<T>
    • IConfigurationSerializationContext<T>
    • IConfigurationTarget
    • IConfigurationTransformer<TOutput>
    • IConfigurationTraversalContext
    • IntegralConfigurationNode
    • ListConfigurationNode
    • StringConfigurationNode
    • UnknownConfigurationNode
  • Snowflake.Configuration.Serialization.Serializers
    • AbstractStringConfigurationSerializer
    • ConfigurationSerializer<T>
    • StringSerializationContext
    • StringSerializationContextExtensions
  • Snowflake.Configuration.Serialization.Serializers.Implementations
    • SimpleCfgConfigurationSerializer
    • SimpleIniConfigurationSerializer
    • SimpleJsonConfigurationSerializer
    • SimpleXmlConfigurationSerializer
  • Snowflake.Extensibility
    • IEmptyPluginConfiguration
    • ILogger
    • IPlugin
    • IPluginCollection<T>
    • LogLevel
    • PluginAttribute
    • PluginCollection<T>
    • PluginInfoFields
  • Snowflake.Extensibility.Configuration
    • IPluginConfigurationStore
  • Snowflake.Extensibility.Provisioning
    • IPluginProperties
    • IPluginProvision
    • IProvisionedPlugin
    • PluginProvision
    • ProvisionedPlugin
  • Snowflake.Extensibility.Provisioning.Standalone
    • StandalonePlugin
    • StandalonePluginProvision
  • Snowflake.Extensibility.Queueing
    • IAsyncJobQueue
    • IAsyncJobQueue<T>
    • IAsyncJobQueue<TAsyncEnumerable, T>
    • IAsyncJobQueueFactory
  • Snowflake.Filesystem
    • DirectoryExtensions
    • FileExtensions
    • IDirectory
    • IFile
    • IIndelibleDirectory
    • IReadOnlyDirectory
    • IReadOnlyFile
  • Snowflake.Input.Controller
    • ControllerElement
    • ControllerElementCollection
    • ControllerElementExtensions
    • ControllerElementInfo
    • ControllerElementType
    • ControllerElementTypeExtensions
    • ControllerId
    • IControllerElementCollection
    • IControllerElementInfo
    • IControllerLayout
    • InvalidControllerIdException
  • Snowflake.Input.Controller.Mapped
    • ControllerElementMapping
    • ControllerElementMappingProfile
    • IControllerElementMappingProfile
    • IControllerElementMappingProfileStore
  • Snowflake.Input.Device
    • DefaultDeviceCapabilityLabels
    • DeviceCapability
    • DeviceCapabilityClass
    • DeviceCapabilityClasses
    • DeviceCapabilityExtensions
    • DeviceLayoutMapping
    • DictionaryDeviceCapabilityLabels
    • DirectInputDeviceInstance
    • IDeviceCapabilityLabels
    • IDeviceLayoutMapping
    • IInputDevice
    • IInputDeviceInstance
    • InputDriver
    • KeyboardDeviceInstance
    • PassthroughDeviceInstance
    • XInputDeviceInstance
  • Snowflake.Installation
    • AsyncInstallTask<T>
    • AsyncInstallTaskEnumerable<T>
    • ITaskResult
    • TaskResult
    • TaskResult<T>
  • Snowflake.Installation.Extensibility
    • GameInstaller
    • IGameInstaller
    • IInstallable
    • Installable
    • SupportedPlatformAttribute
  • Snowflake.Installation.Tasks
    • CopyDirectoryContentsTask
    • CopyFileTask
    • ExecuteAsyncTask<TResult>
    • ExtractZipTask
    • FailureTask<T>
  • Snowflake.Loader
    • IComposable
    • IModule
    • IModuleEnumerator
    • IModuleLoader<T>
    • ImportServiceAttribute
    • IServiceRepository
    • Module
  • Snowflake.Model.Database.Exceptions
    • DependentEntityNotExistsException
    • EntityAlreadyExistsException
  • Snowflake.Model.Database.Migrations
    • Empty
    • InitialCreate
  • Snowflake.Model.Game
    • Game
    • IGame
    • IGameExtension
    • IGameLibrary
    • IPlatformInfo
    • ISystemFile
    • PlatformId
  • Snowflake.Model.Game.LibraryExtensions
    • GameConfigurationExtensionExtensions
    • GameFileExtensionExtensions
    • IGameConfigurationExtension
    • IGameConfigurationExtensionProvider
    • IGameExtensionProvider
    • IGameExtensionProvider<TExtension>
    • IGameFileExtension
    • IGameFileExtensionProvider
  • Snowflake.Model.Records
    • FileRecord
    • GameRecord
    • IMetadataCollection
    • IRecord
    • IRecordMetadata
    • IRecordMetadataQuery
    • MetadataCollection
    • RecordMetadata
  • Snowflake.Model.Records.File
    • FileMetadataKeys
    • IFileRecord
    • ImageMetadataKeys
    • ImageTypes
  • Snowflake.Model.Records.Game
    • GameMetadataKeys
    • IGameRecord
    • IGameRecordQuery
  • Snowflake.Orchestration.Extensibility
    • EmulatedController
    • EmulatedPortsManager
    • EmulatorCompatibility
    • EmulatorOrchestrator
    • GameEmulation
    • GameEmulation<TConfigurationCollection>
    • GameEmulationState
    • IEmulatedController
    • IEmulatedPortDeviceEntry
    • IEmulatedPortsManager
    • IEmulatedPortStore
    • IEmulatorOrchestrator
    • IGameEmulation
  • Snowflake.Orchestration.Extensibility.Extensions
    • DeviceEnumeratorExtensions
  • Snowflake.Orchestration.Process
    • IEmulatorExecutable
    • IEmulatorExecutableProvider
    • IProcessBuilder
    • ProcessExtensions
  • Snowflake.Orchestration.Saving
    • GameFileExtensionGameSaveManagerExtensions
    • IGameSaveManager
    • ISaveGame
    • ISaveProfile
    • SaveGame
    • SaveManagementStrategy
  • Snowflake.Orchestration.SystemFiles
    • ISystemFileProvider
  • Snowflake.Persistence
    • ISqlDatabase
    • SqliteDatabase
    • SqliteMemoryDatabase
  • Snowflake.Remoting.Electron
    • IElectronPackage
    • IElectronPackageProvider
  • Snowflake.Remoting.Kestrel
    • IKestrelServerMiddlewareProvider
    • IKestrelWebServerService
  • Snowflake.Romfile
    • IFileSignature
    • IRomFileInfo
    • IStructuredFilename
    • NamingConvention
    • RomFileInfo
    • StructuredFilename
  • Snowflake.Romfile.Extensions
    • StringExtensions
  • Snowflake.Romfile.Tokenizer
    • FieldType
    • GoodToolsTokenClassifier
    • NoIntroTokenClassifier
    • StructuredFilenameToken
  • Snowflake.Scraping
    • GameScrapeContext
    • IScrapeContext
    • ISeed
    • ISeedRootContext
    • Seed
    • SeedContent
    • SeedRootContext
  • Snowflake.Scraping.Extensibility
    • AttachTarget
    • Culler
    • Directive
    • DirectiveAttribute
    • FileInstallationTraverserBase
    • GameMetadataTraverserBase
    • ICuller
    • IFileInstallationTraverser
    • IGameMetadataTraverser
    • IScraper
    • IScraperDirective
    • ITraverser<TProducts, TEffectTarget>
    • Scraper
    • SeedBuilder
    • SeedTree
    • Traverser<TProducts, TEffectTarget>
  • Snowflake.Services
    • IContentDirectoryProvider
    • IDeviceEnumerator
    • ILogProvider
    • IPluginManager
    • IServiceEnumerator
    • IServiceRegistrationProvider
    • IStoneProvider
  • Snowflake.Shiragame
    • IRomInfo
    • ISerialInfo
    • IShiragameProvider
    • RomInfo
    • SerialInfo

Interface IGameLibrary

Represents an extendable Game library. An instance of IGameLibrary is one of the core services that are always available when Snowflake starts, and handles all information related to games, including files and configuration.

Implements the repository pattern for IGame.

Namespace: Snowflake.Model.Game
Assembly: Snowflake.Framework.Primitives.dll
Syntax
public interface IGameLibrary

Methods

AddExtension<TExtensionProvider, TExtension>(TExtensionProvider)

Registers an extension to the game library.

Extensions are responsible for their own data, and are created using a factory of type TExtensionProvider. Extensions are local to a given IGameRecord that exists in this library, and are responsible for managing their own data. It is also idiomatic to create an extension method WithExtension to allow fluent access to the extension.

See GameFileExtensionExtensions for an example of how such extension methods are implemented.

Declaration
void AddExtension<TExtensionProvider, TExtension>(TExtensionProvider extension)

    where TExtensionProvider : IGameExtensionProvider<TExtension> where TExtension : class, IGameExtension
Parameters
Type Name Description
TExtensionProvider extension

An instance of the extension factory.

Type Parameters
Name Description
TExtensionProvider

The type of the extension provider.

TExtension

The extension instance that is produced for a game.

CreateGame(PlatformId)

Creates a game in the game library.

Declaration
IGame CreateGame(PlatformId platformId)
Parameters
Type Name Description
PlatformId platformId
Returns
Type Description
IGame

CreateGameAsync(PlatformId)

Asynchronously creates a game in the game library.

Declaration
Task<IGame> CreateGameAsync(PlatformId platformId)
Parameters
Type Name Description
PlatformId platformId
Returns
Type Description
System.Threading.Tasks.Task<IGame>

GetAllGames()

Retrieves all games in the library. See GetGames(Expression<Func<IGameRecord, Boolean>>) instead, instead of enumerating all possible games.

Declaration
IQueryable<IGame> GetAllGames()
Returns
Type Description
System.Linq.IQueryable<IGame>

All games in the library.

GetAllGamesAsync()

Asynchronously retrieves all games in the library. See GetGames(Expression<Func<IGameRecord, Boolean>>) instead, instead of enumerating all possible games.

Declaration
IAsyncEnumerable<IGame> GetAllGamesAsync()
Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<IGame>

All games in the library.

GetExtension<T>()

Gets a registered extension provider of the given type. If no extension of type T is registered, returns null.

Declaration
T GetExtension<T>()

    where T : class, IGameExtensionProvider
Returns
Type Description
T

The regsitered instance of the requested extension provider.

Type Parameters
Name Description
T

The type of the extension provider.

GetGame(Guid)

Gets a game that was created in the library by its unique GUID.

Declaration
IGame GetGame(Guid guid)
Parameters
Type Name Description
System.Guid guid

The unique GUID of the game.

Returns
Type Description
IGame

The game with the provided GUID, or null if it does not exist

GetGameAsync(Guid)

Asynchronously gets a game that was created in the library by its unique GUID.

Declaration
Task<IGame> GetGameAsync(Guid guid)
Parameters
Type Name Description
System.Guid guid

The unique GUID of the game.

Returns
Type Description
System.Threading.Tasks.Task<IGame>

The game with the provided GUID, or null if it does not exist

GetGames(Expression<Func<IGameRecord, Boolean>>)

Retrieves all games in the library that fulfill the provided predicate. The default implementation executes this predicate in client code. Use QueryGames(Expression<Func<IGameRecordQuery, Boolean>>) instead if possible for more performant queries.

Declaration
IEnumerable<IGame> GetGames(Expression<Func<IGameRecord, bool>> predicate)
Parameters
Type Name Description
System.Linq.Expressions.Expression<System.Func<IGameRecord, System.Boolean>> predicate

The predicate to filter on.

Returns
Type Description
System.Collections.Generic.IEnumerable<IGame>

All games in the library that fulfill the provided predicate.

QueryGames(Expression<Func<IGameRecordQuery, Boolean>>)

Retrieves all games in the library that fulfill the provided predicate. The default implementation executes the predicate on the database than in client code, thus is much faster than using GetAllGames() or GetGames(Expression<Func<IGameRecord, Boolean>>).

Declaration
IQueryable<IGame> QueryGames(Expression<Func<IGameRecordQuery, bool>> predicate)
Parameters
Type Name Description
System.Linq.Expressions.Expression<System.Func<IGameRecordQuery, System.Boolean>> predicate

The predicate to filter on.

Returns
Type Description
System.Linq.IQueryable<IGame>

All games in the library that fulfill the provided predicate.

QueryGamesAsync(Expression<Func<IGameRecordQuery, Boolean>>)

Retrieves all games in the library that fulfill the provided predicate asynchronously. The default implementation executes this predicate on the database rather than in client code, thus is much faster than using GetAllGamesAsync() or GetGames(Expression<Func<IGameRecord, Boolean>>).

Declaration
IAsyncEnumerable<IGame> QueryGamesAsync(Expression<Func<IGameRecordQuery, bool>> predicate)
Parameters
Type Name Description
System.Linq.Expressions.Expression<System.Func<IGameRecordQuery, System.Boolean>> predicate

The predicate to filter on.

Returns
Type Description
System.Collections.Generic.IAsyncEnumerable<IGame>

All games in the library that fulfill the provided predicate.

UpdateGameRecord(IGameRecord)

Updates a IGameRecord that exists in the database by providing the changed IGameRecord.

Declaration
void UpdateGameRecord(IGameRecord game)
Parameters
Type Name Description
IGameRecord game

The updated IGameRecord

UpdateGameRecordAsync(IGameRecord)

Asynchronously updates a IGameRecord that exists in the database by providing the changed IGameRecord.

Declaration
Task UpdateGameRecordAsync(IGameRecord game)
Parameters
Type Name Description
IGameRecord game

The updated IGameRecord

Returns
Type Description
System.Threading.Tasks.Task

Extension Methods

GameConfigurationExtensionExtensions.WithConfigurationLibrary(IGameLibrary)
GameFileExtensionExtensions.WithFileLibrary(IGameLibrary)
In This Article
  • Methods
    • AddExtension<TExtensionProvider, TExtension>(TExtensionProvider)
    • CreateGame(PlatformId)
    • CreateGameAsync(PlatformId)
    • GetAllGames()
    • GetAllGamesAsync()
    • GetExtension<T>()
    • GetGame(Guid)
    • GetGameAsync(Guid)
    • GetGames(Expression<Func<IGameRecord, Boolean>>)
    • QueryGames(Expression<Func<IGameRecordQuery, Boolean>>)
    • QueryGamesAsync(Expression<Func<IGameRecordQuery, Boolean>>)
    • UpdateGameRecord(IGameRecord)
    • UpdateGameRecordAsync(IGameRecord)
  • Extension Methods
Built with ❤️ by @chyyran. Text content licensed under CC-BY-SA 4.0.