C# Class Depressurizer.GameList

Represents a complete collection of games and categories.
Datei anzeigen Open project: Theo47/depressurizer Class Usage Examples

Public Properties

Property Type Description
Categories List
Filters List
Games GameInfo>.Dictionary

Public Methods

Method Description
AddCategory ( string name ) : Category

Adds a new category to the list.

AddFilter ( string name ) : Depressurizer.Filter

Adds a new Filter to the list.

AddGameCategory ( int gameID, Category c ) : void

Adds a single category to a single game

AddGameCategory ( int gameID, ICollection cats ) : void

Adds a set of categories to a single game

CategoryExists ( string name ) : bool

Checks to see if a category with the given name exists

Clear ( ) : void
ClearGameCategories ( int gameID, bool preserveFavorite ) : void

Clears all categories from a single game

ExportSteamConfig ( long steamId, bool discardMissing, bool includeShortcuts ) : void

Writes Steam game category information to Steam user config file.

ExportSteamConfigFile ( string filePath, bool discardMissing ) : void

Writes Steam game category information to Steam user config file.

ExportSteamShortcuts ( long SteamId ) : void

Writes category info for shortcut games to shortcuts.vdf config file for specified Steam user. Loads the shortcut config file, then tries to match each game in the file against one of the games in the gamelist. If it finds a match, it updates the config file with the new category info.

FetchHtmlFromUrl ( string url ) : string

Fetches an HTML game list and returns the full page text. Mostly just grabs the given HTTP response, except that it throws an errors if the profile is not public, and writes approrpriate log entries.

FetchHtmlGameList ( System.Int64 accountId ) : string

Grabs the HTML game list for the given account and returns its full text.

FetchHtmlGameList ( string customUrl ) : string

Grabs the HTML game list for the given account and returns its full text.

FetchXmlFromUrl ( string url ) : XmlDocument

Fetches an XML game list and loads it into an XML document.

FetchXmlGameList ( System.Int64 steamId ) : XmlDocument

Grabs the XML game list for the given account and reads it into an XmlDocument.

FetchXmlGameList ( string customUrl ) : XmlDocument

Grabs the XML game list for the given account and reads it into an XmlDocument.

FilterExists ( string name ) : bool

Checks to see if a Filter with the given name exists

GameList ( ) : System
GetCategory ( string name ) : Category

Gets the category with the given name. If the category does not exist, creates it.

GetFilter ( string name ) : Depressurizer.Filter

Gets the Filter with the given name. If the Filter does not exist, creates it.

HideGames ( int gameID, bool hide ) : void

Add or Remove the hidden attribute of a single game

ImportSteamConfig ( long SteamId, SortedSet ignore, AppTypes includedTypes, bool includeShortcuts ) : int

Loads category info from the steam config file for the given Steam user.

ImportSteamConfigFile ( string filePath, SortedSet ignore, AppTypes includedTypes ) : int

Loads category info from the given steam config file.

ImportSteamShortcuts ( long SteamId ) : int

Updates set of non-Steam games. Will remove any games that are currently in the list but not found in the Steam config.

IntegrateHtmlGameList ( string page, bool overWrite, SortedSet ignore, AppTypes includedTypes, int &newItems ) : int

Integrates list of games from an HTML page into the loaded game list.

IntegrateXmlGameList ( XmlDocument doc, bool overWrite, SortedSet ignore, AppTypes includedTypes, int &newItems ) : int

Integrates list of games from an XmlDocument into the loaded game list.

ProcessUnicode ( string val ) : string

Searches a string for HTML unicode entities ('\u####') and replaces them with actual unicode characters.

RemoveCategory ( Category c ) : bool

Removes the given category.

RemoveEmptyCategories ( ) : int

Remove all empty categories from the category list.

RemoveFilter ( Depressurizer.Filter f ) : bool

Removes the given Filter.

RemoveGameCategory ( int gameID, Category c ) : void

Removes a single category from a single game.

RemoveGameCategory ( int gameID, ICollection cats ) : void

Removes a set of categories from a single game

RenameCategory ( Category c, string newName ) : Category

Renames the given category.

SetGameCategories ( int gameID, Category cat, bool preserveFavorites ) : void
SetGameCategories ( int gameID, ICollection catSet, bool preserveFavorites ) : void

Sets a game's categories to a particular set

UpdateGameListFromOwnedPackageInfo ( System.Int64 accountId, SortedSet ignored, AppTypes includedTypes, int &newApps ) : int

Updates the game list based on data from the localconfig file and the package cache, including LastPlayed.

Private Methods

Method Description
FindMatchingShortcut ( int shortcutId, VdfFileNode shortcutNode, List gamesToMatchAgainst, StringDictionary shortcutLaunchIds ) : int

Searches a list of games, looking for the one that matches the information in the shortcut node. Checks launch ID first, then checks a combination of name and ID, then just checks name.

GetLastPlayedFromVdf ( VdfFileNode appsNode, SortedSet ignore, AppTypes includedTypes ) : void

Get LastPlayed date from a VDF node containing a list of games. Any games in the node not found in the game list will be added to the gamelist.

IntegrateGame ( int appId, string appName, bool overwriteName, SortedSet ignore, AppTypes includedTypes, GameListingSource src, bool &isNew ) : GameInfo

Adds a new game to the database, or updates an existing game with new information.

IntegrateGamesFromVdf ( VdfFileNode appsNode, SortedSet ignore, AppTypes includedTypes ) : int

Loads in games from a VDF node containing a list of games. Any games in the node not found in the game list will be added to the gamelist. If a game in the node has a tags subnode, the "favorite" field will be overwritten. If a game in the node has a category set, it will overwrite any categories in the gamelist. If a game in the node does NOT have a category set, the category in the gamelist will NOT be cleared.

IntegrateShortcut ( int gameId, VdfFileNode gameNode, StringDictionary launchIds ) : bool

Adds a non-steam game to the gamelist.

LoadShortcutLaunchIds ( long SteamId, StringDictionary &shortcutLaunchIds ) : bool

Load launch IDs for external games from screenshots.vdf

RemoveGame ( int appId ) : bool

Removes a game from the game list.

Method Details

AddCategory() public method

Adds a new category to the list.
public AddCategory ( string name ) : Category
name string Name of the category to add
return Category

AddFilter() public method

Adds a new Filter to the list.
public AddFilter ( string name ) : Depressurizer.Filter
name string Name of the Filter to add
return Depressurizer.Filter

AddGameCategory() public method

Adds a single category to a single game
public AddGameCategory ( int gameID, Category c ) : void
gameID int Game ID to add category to
c Category Category to add
return void

AddGameCategory() public method

Adds a set of categories to a single game
public AddGameCategory ( int gameID, ICollection cats ) : void
gameID int Game ID to add to
cats ICollection Categories to add
return void

CategoryExists() public method

Checks to see if a category with the given name exists
public CategoryExists ( string name ) : bool
name string Name of the category to look for
return bool

Clear() public method

public Clear ( ) : void
return void

ClearGameCategories() public method

Clears all categories from a single game
public ClearGameCategories ( int gameID, bool preserveFavorite ) : void
gameID int Game ID to clear categories from
preserveFavorite bool
return void

ExportSteamConfig() public method

Writes Steam game category information to Steam user config file.
public ExportSteamConfig ( long steamId, bool discardMissing, bool includeShortcuts ) : void
steamId long Steam ID of user to save the config file for
discardMissing bool If true, any pre-existing game entries in the file that do not have corresponding entries in the GameList are removed
includeShortcuts bool If true, also saves the Steam shortcut category data
return void

ExportSteamConfigFile() public method

Writes Steam game category information to Steam user config file.
public ExportSteamConfigFile ( string filePath, bool discardMissing ) : void
filePath string Full path of the steam config file to save
discardMissing bool If true, any pre-existing game entries in the file that do not have corresponding entries in the GameList are removed
return void

ExportSteamShortcuts() public method

Writes category info for shortcut games to shortcuts.vdf config file for specified Steam user. Loads the shortcut config file, then tries to match each game in the file against one of the games in the gamelist. If it finds a match, it updates the config file with the new category info.
public ExportSteamShortcuts ( long SteamId ) : void
SteamId long Identifier of Steam user to save information
return void

FetchHtmlFromUrl() public static method

Fetches an HTML game list and returns the full page text. Mostly just grabs the given HTTP response, except that it throws an errors if the profile is not public, and writes approrpriate log entries.
public static FetchHtmlFromUrl ( string url ) : string
url string The URL to fetch
return string

FetchHtmlGameList() public static method

Grabs the HTML game list for the given account and returns its full text.
public static FetchHtmlGameList ( System.Int64 accountId ) : string
accountId System.Int64 The 64-bit account ID
return string

FetchHtmlGameList() public static method

Grabs the HTML game list for the given account and returns its full text.
public static FetchHtmlGameList ( string customUrl ) : string
customUrl string The custom name for the account
return string

FetchXmlFromUrl() public static method

Fetches an XML game list and loads it into an XML document.
public static FetchXmlFromUrl ( string url ) : XmlDocument
url string The URL to fetch
return System.Xml.XmlDocument

FetchXmlGameList() public static method

Grabs the XML game list for the given account and reads it into an XmlDocument.
public static FetchXmlGameList ( System.Int64 steamId ) : XmlDocument
steamId System.Int64
return System.Xml.XmlDocument

FetchXmlGameList() public static method

Grabs the XML game list for the given account and reads it into an XmlDocument.
public static FetchXmlGameList ( string customUrl ) : XmlDocument
customUrl string The custom name for the account
return System.Xml.XmlDocument

FilterExists() public method

Checks to see if a Filter with the given name exists
public FilterExists ( string name ) : bool
name string Name of the Filter to look for
return bool

GameList() public method

public GameList ( ) : System
return System

GetCategory() public method

Gets the category with the given name. If the category does not exist, creates it.
public GetCategory ( string name ) : Category
name string Name to get the category for
return Category

GetFilter() public method

Gets the Filter with the given name. If the Filter does not exist, creates it.
public GetFilter ( string name ) : Depressurizer.Filter
name string Name to get the Filter for
return Depressurizer.Filter

HideGames() public method

Add or Remove the hidden attribute of a single game
public HideGames ( int gameID, bool hide ) : void
gameID int Game ID to hide/unhide
hide bool Whether the game should be hidden.
return void

ImportSteamConfig() public method

Loads category info from the steam config file for the given Steam user.
public ImportSteamConfig ( long SteamId, SortedSet ignore, AppTypes includedTypes, bool includeShortcuts ) : int
SteamId long Identifier of Steam user
ignore SortedSet Set of games to ignore
includedTypes AppTypes
includeShortcuts bool If true, also import shortcut data
return int

ImportSteamConfigFile() public method

Loads category info from the given steam config file.
public ImportSteamConfigFile ( string filePath, SortedSet ignore, AppTypes includedTypes ) : int
filePath string The path of the file to open
ignore SortedSet Set of game IDs to ignore
includedTypes AppTypes
return int

ImportSteamShortcuts() public method

Updates set of non-Steam games. Will remove any games that are currently in the list but not found in the Steam config.
public ImportSteamShortcuts ( long SteamId ) : int
SteamId long The ID64 of the account to load shortcuts for
return int

IntegrateHtmlGameList() public method

Integrates list of games from an HTML page into the loaded game list.
public IntegrateHtmlGameList ( string page, bool overWrite, SortedSet ignore, AppTypes includedTypes, int &newItems ) : int
page string The full text of the page to load
overWrite bool If true, overwrite the names of games already in the list.
ignore SortedSet A set of item IDs to ignore. Can be null.
includedTypes AppTypes
newItems int The number of new items actually added
return int

IntegrateXmlGameList() public method

Integrates list of games from an XmlDocument into the loaded game list.
public IntegrateXmlGameList ( XmlDocument doc, bool overWrite, SortedSet ignore, AppTypes includedTypes, int &newItems ) : int
doc System.Xml.XmlDocument The XmlDocument containing the new game list
overWrite bool If true, overwrite the names of games already in the list.
ignore SortedSet A set of item IDs to ignore.
includedTypes AppTypes
newItems int The number of new items actually added
return int

ProcessUnicode() public method

Searches a string for HTML unicode entities ('\u####') and replaces them with actual unicode characters.
public ProcessUnicode ( string val ) : string
val string The string to process
return string

RemoveCategory() public method

Removes the given category.
public RemoveCategory ( Category c ) : bool
c Category Category to remove.
return bool

RemoveEmptyCategories() public method

Remove all empty categories from the category list.
public RemoveEmptyCategories ( ) : int
return int

RemoveFilter() public method

Removes the given Filter.
public RemoveFilter ( Depressurizer.Filter f ) : bool
f Depressurizer.Filter Filter to remove.
return bool

RemoveGameCategory() public method

Removes a single category from a single game.
public RemoveGameCategory ( int gameID, Category c ) : void
gameID int Game ID to remove from
c Category Category to remove
return void

RemoveGameCategory() public method

Removes a set of categories from a single game
public RemoveGameCategory ( int gameID, ICollection cats ) : void
gameID int Game ID to remove from
cats ICollection Set of categories to remove
return void

RenameCategory() public method

Renames the given category.
public RenameCategory ( Category c, string newName ) : Category
c Category Category to rename.
newName string Name to assign to the new category.
return Category

SetGameCategories() public method

public SetGameCategories ( int gameID, Category cat, bool preserveFavorites ) : void
gameID int
cat Category
preserveFavorites bool
return void

SetGameCategories() public method

Sets a game's categories to a particular set
public SetGameCategories ( int gameID, ICollection catSet, bool preserveFavorites ) : void
gameID int Game ID to modify
catSet ICollection Set of categories to apply
preserveFavorites bool If true, will not remove "favorite" category
return void

UpdateGameListFromOwnedPackageInfo() public method

Updates the game list based on data from the localconfig file and the package cache, including LastPlayed.
public UpdateGameListFromOwnedPackageInfo ( System.Int64 accountId, SortedSet ignored, AppTypes includedTypes, int &newApps ) : int
accountId System.Int64 64-bit account ID to update for
ignored SortedSet Set of games to ignore
includedTypes AppTypes
newApps int
return int

Property Details

Categories public_oe property

public List Categories
return List

Filters public_oe property

public List Filters
return List

Games public_oe property

public Dictionary Games
return GameInfo>.Dictionary