-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Supports selective import of games from steam library
- Loading branch information
Showing
9 changed files
with
481 additions
and
145 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,31 @@ | ||
import { importUserSteamGamesToDatabase } from './common' | ||
import { getUserSteamGames, importSelectedSteamGames } from './common' | ||
import { FormattedGameInfo } from './types' | ||
import log from 'electron-log/main.js' | ||
|
||
/** | ||
* Import user steam games to the database | ||
* @param steamId The steam id of the user | ||
* @returns A promise that resolves when the operation is complete. | ||
* @throws An error if the operation fails. | ||
* Getting information about a user's Steam library | ||
* @param steamId Steam User ID | ||
* @returns Steam Game Library Information | ||
*/ | ||
export async function importUserSteamGamesToDB(steamId: string): Promise<void> { | ||
export async function getSteamGames(steamId: string): Promise<FormattedGameInfo[]> { | ||
try { | ||
await importUserSteamGamesToDatabase(steamId) | ||
return await getUserSteamGames(steamId) | ||
} catch (error) { | ||
log.error('Error adding user steam games to database:', error) | ||
log.error('获取 Steam 游戏库失败:', error) | ||
throw error | ||
} | ||
} | ||
|
||
/** | ||
* Import selected Steam games to the database | ||
* @param games Selected Steam games | ||
* @returns Number of games imported | ||
*/ | ||
export async function importSteamGames(games: FormattedGameInfo[]): Promise<number> { | ||
try { | ||
return await importSelectedSteamGames(games) | ||
} catch (error) { | ||
log.error('导入 Steam 游戏失败:', error) | ||
throw error | ||
} | ||
} |
Oops, something went wrong.