remove config type

This commit is contained in:
Maroxy 2021-10-24 12:05:24 +02:00
parent ac71ef16c6
commit 2216deea51

View file

@ -42,29 +42,6 @@ type DXVK = {
uri: string uri: string
}; };
type Config = {
lang: {
launcher: 'en-us' | 'ru-ru' | 'fr-fr' | 'id-id' | 'de-de' | 'es-es' | 'pt-pt' | 'th-th' | 'vi-vn' | 'ko-kr' | 'ja-jp' | 'zh-tw' | 'zh-cn',
voice: 'en-us' | 'ko-kr' | 'ja-jp' | 'zh-cn'
},
background: {
time: string|null,
file: string|null
},
version: string|null,
patch: {
version: string|null,
state: 'testing' | 'stable'
},
runner: null | {
name: string,
folder: string,
executable: string
},
dxvk: string|null,
rpc: boolean
};
export class Genshinlib export class Genshinlib
{ {
public static readonly patchDir: string = path.join(path.dirname(__dirname), '..', 'patch'); public static readonly patchDir: string = path.join(path.dirname(__dirname), '..', 'patch');
@ -88,7 +65,7 @@ export class Genshinlib
protected static readonly runnersUri: string = 'https://notabug.org/nobody/an-anime-game-launcher/raw/main/runners.json'; protected static readonly runnersUri: string = 'https://notabug.org/nobody/an-anime-game-launcher/raw/main/runners.json';
protected static readonly dxvksUri: string = 'https://notabug.org/nobody/an-anime-game-launcher/raw/main/dxvks.json'; protected static readonly dxvksUri: string = 'https://notabug.org/nobody/an-anime-game-launcher/raw/main/dxvks.json';
public static get version(): Config['version'] public static get version(): string|null
{ {
return this.getConfig('version'); return this.getConfig('version');
} }
@ -155,20 +132,9 @@ export class Genshinlib
}*/ }*/
} }
public static setConfig (info: Config): Genshinlib
{
fs.writeFileSync(this.launcherJson, JSON.stringify(info, null, 4));
return this;
}
public static updateConfig (cname: string, value: string|boolean|null|number): Genshinlib public static updateConfig (cname: string, value: string|boolean|null|number): Genshinlib
{ {
return config.set(cname, value); return config.set(cname, value);
//return this.setConfig({
// ...this.getConfig(),
// ...config
//});
} }
public static async getData (): Promise<any> public static async getData (): Promise<any>