mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
add possibility to change installations folder
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { IpcResponse } from 'shared/models/ipc-models.model';
|
||||
import { DownloadInfo } from '../../main/ipcs/bs-download-ipcs';
|
||||
import { BSVersion } from '../../main/services/bs-version-manager.service'
|
||||
import { BSVersionManagerService } from './bs-version-manager.service';
|
||||
import { IpcService } from './ipc.service';
|
||||
import { ModalExitCode, ModalService, ModalType } from './modale.service';
|
||||
|
||||
export class BsDownloaderService{
|
||||
@@ -9,6 +11,7 @@ export class BsDownloaderService{
|
||||
private static instance: BsDownloaderService;
|
||||
|
||||
private readonly modalService: ModalService = ModalService.getInsance();
|
||||
private readonly ipcService: IpcService;
|
||||
private readonly bsVersionManager: BSVersionManagerService = BSVersionManagerService.getInstance();
|
||||
|
||||
public readonly currentBsVersionDownload$: BehaviorSubject<BSVersion> = new BehaviorSubject(null);
|
||||
@@ -16,6 +19,7 @@ export class BsDownloaderService{
|
||||
|
||||
public readonly selectedBsVersion$: BehaviorSubject<BSVersion> = new BehaviorSubject(null);
|
||||
|
||||
|
||||
public static getInstance(): BsDownloaderService{
|
||||
if(!BsDownloaderService.instance){ BsDownloaderService.instance = new BsDownloaderService(); }
|
||||
return BsDownloaderService.instance;
|
||||
@@ -23,6 +27,7 @@ export class BsDownloaderService{
|
||||
|
||||
private constructor(){
|
||||
this.asignListerners();
|
||||
this.ipcService = IpcService.getInstance();
|
||||
}
|
||||
|
||||
private asignListerners(): void{
|
||||
@@ -81,4 +86,13 @@ export class BsDownloaderService{
|
||||
return !!this.currentBsVersionDownload$.value || !!this.downloadProgress$.value;
|
||||
}
|
||||
|
||||
public async getInstallationFolder(): Promise<string>{
|
||||
const res = await this.ipcService.send<string>("bs-download.installation-folder");
|
||||
return res.success ? res.data : "";
|
||||
}
|
||||
|
||||
public setInstallationFolder(path: string): Promise<IpcResponse<string>>{
|
||||
return this.ipcService.send<string>("bs-download.set-installation-folder", {args: path});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ export enum ModalType {
|
||||
STEAM_LOGIN = "STEAM_LOGIN",
|
||||
GUARD_CODE = "GUARD_CODE",
|
||||
UNINSTALL = "UNINSTALL",
|
||||
INSTALLATION_FOLDER = "INSTALLATION_FOLDER",
|
||||
}
|
||||
|
||||
export enum ModalExitCode {
|
||||
|
||||
Reference in New Issue
Block a user