mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
add progression when download
This commit is contained in:
@@ -94,11 +94,13 @@ export class BSInstallerService{
|
||||
console.log(match);
|
||||
const out = match.split("|");
|
||||
|
||||
if(out[0] === DownloadEventType.NOT_LOGGED_IN && downloadInfos.password){ setTimeout(() => {this.sendInputProcess(downloadInfos.password); console.log("*** LOGIN ***")}, 5000) }
|
||||
if(out[0] === DownloadEventType.NOT_LOGGED_IN && downloadInfos.password){ this.sendInputProcess(downloadInfos.password); console.log("*** LOGIN ***"); }
|
||||
else if(out[0] === DownloadEventType.NOT_LOGGED_IN){ this.downloadProcess.kill(); this.utils.ipcSend(`bs-download.${DownloadEventType.NOT_LOGGED_IN}`); }
|
||||
else if(out[0] === DownloadEventType.GUARD_CODE){ this.utils.ipcSend(`bs-download.${DownloadEventType.GUARD_CODE}`); }
|
||||
else if(out[0] === DownloadEventType.TWO_FA_CODE){ this.utils.ipcSend(`bs-download.${DownloadEventType.TWO_FA_CODE}`); }
|
||||
else if(out[0] === DownloadEventType.PROGESS){ this.utils.ipcSend(`bs-download.${DownloadEventType.PROGESS}`, parseFloat(out[1])); }
|
||||
else if(out[0] === DownloadEventType.PROGESS){
|
||||
this.utils.ipcSend(`bs-download.${DownloadEventType.PROGESS}`, parseFloat(out[1]));
|
||||
}
|
||||
else if(out[0] === DownloadEventType.FINISH){ this.utils.ipcSend(`bs-download.${DownloadEventType.FINISH}`); this.downloadProcess.kill(); }
|
||||
else if(out[0] === DownloadEventType.ERROR){
|
||||
console.log("ERROR");
|
||||
|
||||
@@ -12,12 +12,15 @@ export class BsDownloaderService{
|
||||
private readonly bsVersionManager: BSVersionManagerService = BSVersionManagerService.getInstance();
|
||||
|
||||
private readonly downloadedVersions$: BehaviorSubject<BSVersion[]> = new BehaviorSubject([]);
|
||||
private readonly currentBsVersionDownload$: BehaviorSubject<BSVersion> = new BehaviorSubject(null);
|
||||
private readonly downloadProgress$: BehaviorSubject<number> = new BehaviorSubject(0);
|
||||
|
||||
private constructor(){
|
||||
window.electron.ipcRenderer.on(`bs-download.[Password]`, async (bsVersion: BSVersion) => {
|
||||
const res = await this.modalService.openModal(ModalType.STEAM_LOGIN);
|
||||
if(res.exitCode !== ModalExitCode.COMPLETED){ return; }
|
||||
window.electron.ipcRenderer.sendMessage('bs-download.start', {bsVersion: bsVersion, username: res.data.username, password: res.data.password, stay: res.data.stay} as DownloadInfo)
|
||||
this.currentBsVersionDownload$.next(bsVersion);
|
||||
});
|
||||
|
||||
window.electron.ipcRenderer.on("bs-download.[Guard]", async () => {
|
||||
@@ -29,6 +32,10 @@ export class BsDownloaderService{
|
||||
window.electron.ipcRenderer.on("bs-download.[Finished]", async () => {
|
||||
this.bsVersionManager.askInstalledVersions();
|
||||
});
|
||||
|
||||
window.electron.ipcRenderer.on("bs-download.[Progress]", async (progress: number) => {
|
||||
this.downloadProgress$.next(progress);
|
||||
})
|
||||
}
|
||||
|
||||
public static getInstance(){
|
||||
@@ -47,6 +54,7 @@ export class BsDownloaderService{
|
||||
else{
|
||||
window.electron.ipcRenderer.sendMessage('bs-download.start', {bsVersion: bsVersion, username: username} as DownloadInfo);
|
||||
}
|
||||
this.currentBsVersionDownload$.next(bsVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user