forked from ark120202/find-steam-app
-
Notifications
You must be signed in to change notification settings - Fork 2
/
manifest.ts
45 lines (41 loc) · 1.21 KB
/
manifest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import fs from 'fs-extra';
import path from 'path';
import vdf from 'vdf-extra';
export interface AppManifest {
appid: number;
Universe: number;
name: string;
StateFlags: number;
installdir: string;
LastUpdated: number;
UpdateResult: 0 | 1;
SizeOnDisk: number;
buildid: number;
LastOwner: string;
BytesToDownload: number;
BytesDownloaded: number;
AutoUpdateBehavior: 0 | 1;
AllowOtherDownloadsWhileRunning: 0 | 1;
ScheduledAutoUpdate: number;
UserConfig: {
language: string;
DisabledDLC?: string;
optionaldlc?: string;
};
InstalledDepots: Record<string, { manifest: string; dlcappid?: number }>;
MountedDepots: Record<string, string>;
InstallScripts?: Record<string, string>;
ShaderDepot?: {
ManifestID: string;
DepotSize: number;
};
}
export async function hasManifest(library: string, appid: number) {
return fs.pathExists(path.join(library, `appmanifest_${appid}.acf`));
}
export async function readManifest(library: string, appid: number) {
const manifestPath = path.join(library, `appmanifest_${appid}.acf`);
const manifestContent = await fs.readFile(manifestPath, 'utf8');
const manifestData = vdf.parse<AppManifest>(manifestContent);
return manifestData;
}