IDataManager7.10
Interface in Unbroken.LaunchBox.Plugins.Data
public interface IDataManager
This interface provides access to all data in LaunchBox/Big Box. Use the PluginHelper's static PluginHelper.DataManager property to access the instance methods and read and write LaunchBox data.
Methods
AddGameController11.12Adds a controllerAddNewEmulatorAdds a new Emulator to the user's collection.AddNewGameAdds a new Game to the user's collection.AddNewPlatformAdds a new Platform to the user's collection.AddNewPlatformCategoryAdds a new Platform Category to the user's collection.AddNewPlaylistAdds a new Playlist to the user's collection.BackgroundReloadSaveRecommended instead of other Reload and Save methods when quickly saving a single or small amount of values in the data. Completely avoids Dropbox, Google Drive, etc. sync issues by making sure that all changed data is loaded from disk before making the specified changes.ForceReloadForces all data to be reloaded from XML files. This method should only ever be necessary to call when significant changes are made to the XML files by something other than the LaunchBox or Big Box applications.GetAllEmulatorsGets all Emulators in the user's collection.GetAllGamesGets all Games in the user's collection.GetAllParents8.8Gets all Parents in the user's collection.GetAllPlatformCategoriesGets all Platform Categories in the user's collection.GetAllPlatformsGets all Platforms in the user's collection.GetAllPlaylistsGets all Playlists in the user's collection.GetEmulatorByIdChanged 13.27Get an Emulator by the Emulator's ID.GetGameByIdChanged 13.27Gets a Game via the Game's ID.GetGameControllers11.12Gets the list of game controllersGetPlatformByNameChanged 13.27Gets a Platform via the Platform's Name.GetPlatformCategoryByNameGets a Platform Category via the Platform Category's Name.GetPlaylistByIdChanged 13.27Gets a Playlist via the Playlist's ID.GetRootPlatformsCategoriesPlaylists8.8Gets the list of root platforms, platform categories, and playlists, which can then be used to parse through children as well.ReloadIfNeededRetained for compatibility. This method does not reload data in LaunchBox or Big Box. Use IDataManager.ForceReload to reload externally modified XML files, which replaces any unsaved changes in memory.SaveSaves all changes to LaunchBox or Big Box data to disk. Will only save XML files that were changed.TryRemoveEmulatorAttempts to remove an Emulator from the user's collection.TryRemoveGameAttempts to remove a Game from the user's collection.TryRemovePlatformAttempts to remove a Platform from the user's collection.TryRemovePlatformCategoryAttempts to remove a Platform Category from the user's collection.TryRemovePlaylistAttempts to remove a Playlist from the user's collection.
AddGameController 11.12
string AddGameController(
string controllerName,
string controllerCategory,
params string[] associatedPlatforms
)
Adds a controller
controllerName- The name of the controller
controllerCategory- The category of the controller
associatedPlatforms- The platforms associated to this controller (optional)
Returns
The ID string the controller is registered toAddNewEmulator
IEmulator AddNewEmulator()
Adds a new Emulator to the user's collection.
Returns
The new Emulator.AddNewGame
IGame AddNewGame(string title)
Adds a new Game to the user's collection.
title- The Title to use for the new Game.
Returns
The new Game.AddNewPlatform
IPlatform AddNewPlatform(string name)
Adds a new Platform to the user's collection.
name- The Name of the Platform to add.
Returns
The new Platform.AddNewPlatformCategory
IPlatformCategory AddNewPlatformCategory(string name)
Adds a new Platform Category to the user's collection.
name- The Name of the Platform Category to add.
Returns
The new Platform CategoryAddNewPlaylist
IPlaylist AddNewPlaylist(string name)
Adds a new Playlist to the user's collection.
name- The Name of the Playlist to add.
Returns
The new Playlist.BackgroundReloadSave
void BackgroundReloadSave(Action changes)
Recommended instead of other Reload and Save methods when quickly saving a single or small amount of values in the data. Completely avoids Dropbox, Google Drive, etc. sync issues by making sure that all changed data is loaded from disk before making the specified changes.
changes- The specified changes to make to the data. A method or an inline expression may be provided here that changes the data as needed after reloading any necessary data from disk, and before saving the new values to disk.
ForceReload
void ForceReload()
Forces all data to be reloaded from XML files. This method should only ever be necessary to call when significant changes are made to the XML files by something other than the LaunchBox or Big Box applications.
GetAllEmulators
IEmulator[] GetAllEmulators()
Gets all Emulators in the user's collection.
Returns
An array of Emulators.GetAllGames
IGame[] GetAllGames()
Gets all Games in the user's collection.
Returns
An array of Games.GetAllParents 8.8
IParent[] GetAllParents()
Gets all Parents in the user's collection.
Returns
An array of Parents.GetAllPlatformCategories
IPlatformCategory[] GetAllPlatformCategories()
Gets all Platform Categories in the user's collection.
Returns
An array of Platform Categories.GetAllPlatforms
IPlatform[] GetAllPlatforms()
Gets all Platforms in the user's collection.
Returns
An array of Platforms.GetAllPlaylists
IPlaylist[] GetAllPlaylists()
Gets all Playlists in the user's collection.
Returns
An array of Playlists.GetEmulatorById Changed 13.27
IEmulator? GetEmulatorById(string id)
Get an Emulator by the Emulator's ID.
id- The ID of the Emulator to retrieve. Maps up directly to the Emulator's IEmulator.Id property.
Returns
The Emulator with the specified ID, or NULL if not found.GetGameById Changed 13.27
IGame? GetGameById(string? id)
Gets a Game via the Game's ID.
id- The ID of the Game to retrieve. Maps up directly to the Game's IGame.Id property.
Returns
The Game with the specified ID, or NULL if not found.GetGameControllers 11.12
IList<IGameController> GetGameControllers()
Gets the list of game controllers
Returns
The game controllers registered in the library.GetPlatformByName Changed 13.27
IPlatform? GetPlatformByName(string name)
Gets a Platform via the Platform's Name.
name- The Name of the Platform to retrieve. Maps up directly to the Platform's IPlatform.Name property.
Returns
The Platform with the associated Name, or NULL if not found.GetPlatformCategoryByName
IPlatformCategory GetPlatformCategoryByName(string name)
Gets a Platform Category via the Platform Category's Name.
name- The Name of the Platform Category to retrieve. Maps up directly to the Platform Category's IPlatformCategory.Name property.
Returns
The Platform Category with the associated Name, or NULL if not found.GetPlaylistById Changed 13.27
IPlaylist? GetPlaylistById(string id)
Gets a Playlist via the Playlist's ID.
id- The ID of the Playlist to retrieve. Maps up directly to the Playlist's IPlaylist.PlaylistId property.
Returns
The Playlist with the associated ID, or NULL if not found.GetRootPlatformsCategoriesPlaylists 8.8
Gets the list of root platforms, platform categories, and playlists, which can then be used to parse through children as well.
Returns
A list of root platforms, platform categories, and playlists.ReloadIfNeeded
Obsolete since 14.1
void ReloadIfNeeded()
Retained for compatibility. This method does not reload data in LaunchBox or Big Box.
Use IDataManager.ForceReload to reload externally modified XML files, which replaces any unsaved changes in memory.
Save
void Save(bool wait = false)
Saves all changes to LaunchBox or Big Box data to disk. Will only save XML files that were changed.
wait- A value specifying whether to wait for the operation to complete. If false is specified, then the save operation will be performed in the background and the method will immediately return.
Remarks
A backup restore excludes new save requests while replacing the data. After restoration, previously obtained data managers cannot save over the restored files. Background requests in either state are ignored; waiting requests report the unavailable operation with an exception.- Exception: InvalidOperationException
waitis true and a backup restore has suspended saving or replaced this data manager.
TryRemoveEmulator
bool TryRemoveEmulator(IEmulator emulator)
Attempts to remove an Emulator from the user's collection.
emulator- The Emulator to remove.
Returns
A value specifying whether the Emulator was successfully removed. If false is returned, most likely the Emulator was not found in the user's collection.TryRemoveGame
bool TryRemoveGame(IGame game)
Attempts to remove a Game from the user's collection.
game- The Game to remove.
Returns
A value specifying whether or not the Game was successfully removed. If false is returned, most likely the Game was not found in the user's collection.TryRemovePlatform
bool TryRemovePlatform(IPlatform platform)
Attempts to remove a Platform from the user's collection.
platform- The Platform to remove.
Returns
A value specifying whether the Platform was successfully removed. If false is returned, most likely the Platform was not found in the user's collection.TryRemovePlatformCategory
bool TryRemovePlatformCategory(IPlatformCategory platformCategory)
Attempts to remove a Platform Category from the user's collection.
platformCategory- The Platform Category to remove.
Returns
A value specifying whether the Platform Category was successfully removed. If false is returned, most likely the Platform Category was not found in the user's collection.TryRemovePlaylist
bool TryRemovePlaylist(IPlaylist playlist)
Attempts to remove a Playlist from the user's collection.
playlist- The Playlist to remove.