From 9fbf81f8f2d47586dd71b7e9867971e2f33a5e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan?= Date: Mon, 12 Dec 2022 22:14:06 +0100 Subject: [PATCH] init change --- src/main/services/configuration.service.ts | 31 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/services/configuration.service.ts b/src/main/services/configuration.service.ts index 1aa2d540..00400873 100644 --- a/src/main/services/configuration.service.ts +++ b/src/main/services/configuration.service.ts @@ -1,10 +1,13 @@ +import { InstallationLocationService } from '../services/installation-location.service'; import ElectronStore from "electron-store"; +import { Template } from 'webpack'; export class ConfigurationService { private static instance: ConfigurationService; private readonly _store: ElectronStore; + private readonly _versionBsStore: ElectronStore; public static getInstance(): ConfigurationService{ if(!ConfigurationService.instance){ ConfigurationService.instance = new ConfigurationService(); } @@ -13,20 +16,40 @@ export class ConfigurationService { private constructor(){ this._store = new ElectronStore(); + this._versionBsStore = new ElectronStore({cwd : InstallationLocationService.getInstance().installationDirectory}); } public get store(): ElectronStore{ return this._store; } + public get versionBsStore() : ElectronStore{ return this._versionBsStore;} - public set(key: string, value: any): void{ + public set(key: string, value: any, storeSelected : string): void{ + if (storeSelected === "store"){ this.store.set(key, value); + } + else if (storeSelected === "versionBsStore") + { + this.versionBsStore.set(key, value); + } + else return null; } - public get(key: string): T{ + public get(key: string,storeSelected : string): T{ + + if (storeSelected === "store"){ return this.store.get(key) as T; + } + else if (storeSelected === "versionBsStore"){ + return this.store.get(key) as T; + } } - public delete(key: string): void{ + public delete(key: string,storeSelected : string): void{ + if (storeSelected === "store"){ this.store.delete(key); + } + else if (storeSelected === "versionBsStore"){ + this.store.delete(key); + } } -} \ No newline at end of file +}