mirror of
https://github.com/WowUp/WowUp.git
synced 2026-04-30 18:54:00 -04:00
@@ -74,6 +74,7 @@ export class ElectronService {
|
||||
public readonly isMac = process.platform === "darwin";
|
||||
public readonly isLinux = process.platform === "linux";
|
||||
public readonly isPortable = !!process.env.PORTABLE_EXECUTABLE_DIR;
|
||||
public readonly isArm64 = process.arch === "arm64";
|
||||
|
||||
public get isElectron(): boolean {
|
||||
return !!(window && window.process && window.process.type);
|
||||
|
||||
@@ -18,6 +18,13 @@ const WOW_CLASSIC_NAME = "WowClassic.exe";
|
||||
const WOW_CLASSIC_PTR_NAME = "WowClassicT.exe";
|
||||
const WOW_CLASSIC_BETA_NAME = "WowClassicB.exe";
|
||||
|
||||
const WOW_RETAIL_NAME_ARM64 = "Wow-arm64.exe";
|
||||
const WOW_RETAIL_PTR_NAME_ARM64 = "WowT-arm64.exe";
|
||||
const WOW_RETAIL_BETA_NAME_ARM64 = "WowB-arm64.exe";
|
||||
const WOW_CLASSIC_NAME_ARM64 = "WowClassic-arm64.exe";
|
||||
const WOW_CLASSIC_PTR_NAME_ARM64 = "WowClassicT-arm64.exe";
|
||||
const WOW_CLASSIC_BETA_NAME_ARM64 = "WowClassicB-arm64.exe";
|
||||
|
||||
const WOW_APP_NAMES = [
|
||||
WOW_RETAIL_NAME,
|
||||
WOW_RETAIL_PTR_NAME,
|
||||
@@ -27,19 +34,32 @@ const WOW_APP_NAMES = [
|
||||
WOW_CLASSIC_BETA_NAME,
|
||||
];
|
||||
|
||||
const WOW_APP_NAMES_ARM64 = [
|
||||
WOW_RETAIL_NAME_ARM64,
|
||||
WOW_RETAIL_PTR_NAME_ARM64,
|
||||
WOW_RETAIL_BETA_NAME_ARM64,
|
||||
WOW_CLASSIC_NAME_ARM64,
|
||||
WOW_CLASSIC_PTR_NAME_ARM64,
|
||||
WOW_CLASSIC_BETA_NAME_ARM64,
|
||||
];
|
||||
|
||||
// BLIZZARD STRINGS
|
||||
const WINDOWS_BLIZZARD_AGENT_PATH = "ProgramData/Battle.net/Agent";
|
||||
const BLIZZARD_PRODUCT_DB_NAME = "product.db";
|
||||
|
||||
export class WarcraftServiceWin implements WarcraftServiceImpl {
|
||||
public constructor(private _electronService: ElectronService, private _fileService: FileService) {}
|
||||
public constructor(
|
||||
private _electronService: ElectronService,
|
||||
private _fileService: FileService,
|
||||
) {}
|
||||
|
||||
public getExecutableExtension(): string {
|
||||
return "exe";
|
||||
}
|
||||
|
||||
public isWowApplication(appName: string): boolean {
|
||||
return WOW_APP_NAMES.includes(appName);
|
||||
const nameList = this._electronService.isArm64 ? WOW_APP_NAMES_ARM64 : WOW_APP_NAMES;
|
||||
return nameList.includes(appName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,22 +88,22 @@ export class WarcraftServiceWin implements WarcraftServiceImpl {
|
||||
}
|
||||
|
||||
public getExecutableName(clientType: WowClientType): string {
|
||||
switch (clientType) {
|
||||
switch (clientType) {
|
||||
case WowClientType.Retail:
|
||||
return WOW_RETAIL_NAME;
|
||||
return this.getRetailName();
|
||||
case WowClientType.ClassicEra:
|
||||
case WowClientType.Classic:
|
||||
return WOW_CLASSIC_NAME;
|
||||
return this.getClassicName();
|
||||
case WowClientType.RetailPtr:
|
||||
case WowClientType.RetailXPtr:
|
||||
return WOW_RETAIL_PTR_NAME;
|
||||
return this.getRetailPtrName();
|
||||
case WowClientType.ClassicPtr:
|
||||
case WowClientType.ClassicEraPtr:
|
||||
return WOW_CLASSIC_PTR_NAME;
|
||||
return this.getClassicPtrName();
|
||||
case WowClientType.Beta:
|
||||
return WOW_RETAIL_BETA_NAME;
|
||||
return this.getRetailBetaName();
|
||||
case WowClientType.ClassicBeta:
|
||||
return WOW_CLASSIC_BETA_NAME;
|
||||
return this.getClassicBetaName();
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -93,30 +113,34 @@ export class WarcraftServiceWin implements WarcraftServiceImpl {
|
||||
const binaryName = path.basename(binaryPath);
|
||||
switch (binaryName) {
|
||||
case WOW_RETAIL_NAME:
|
||||
case WOW_RETAIL_NAME_ARM64:
|
||||
return WowClientType.Retail;
|
||||
case WOW_CLASSIC_NAME:
|
||||
case WOW_CLASSIC_NAME_ARM64:
|
||||
if (binaryPath.toLowerCase().includes(WOW_CLASSIC_ERA_FOLDER)) {
|
||||
return WowClientType.ClassicEra;
|
||||
} else {
|
||||
return WowClientType.Classic;
|
||||
}
|
||||
case WOW_RETAIL_PTR_NAME:
|
||||
case WOW_RETAIL_PTR_NAME_ARM64:
|
||||
if (binaryPath.toLowerCase().includes(WOW_RETAIL_XPTR_FOLDER)) {
|
||||
return WowClientType.RetailXPtr;
|
||||
} else {
|
||||
return WowClientType.RetailPtr;
|
||||
}
|
||||
case WOW_RETAIL_XPTR_FOLDER:
|
||||
return WowClientType.RetailXPtr;
|
||||
case WOW_CLASSIC_PTR_NAME:
|
||||
case WOW_CLASSIC_PTR_NAME_ARM64:
|
||||
if (binaryPath.toLowerCase().includes(WOW_CLASSIC_ERA_PTR_FOLDER)) {
|
||||
return WowClientType.ClassicEraPtr;
|
||||
} else {
|
||||
return WowClientType.ClassicPtr;
|
||||
}
|
||||
case WOW_RETAIL_BETA_NAME:
|
||||
case WOW_RETAIL_BETA_NAME_ARM64:
|
||||
return WowClientType.Beta;
|
||||
case WOW_CLASSIC_BETA_NAME:
|
||||
case WOW_CLASSIC_BETA_NAME_ARM64:
|
||||
return WowClientType.ClassicBeta;
|
||||
default:
|
||||
return WowClientType.None;
|
||||
@@ -126,4 +150,28 @@ export class WarcraftServiceWin implements WarcraftServiceImpl {
|
||||
public resolveProducts(decodedProducts: InstalledProduct[]): InstalledProduct[] {
|
||||
return decodedProducts;
|
||||
}
|
||||
|
||||
private getRetailName(): string {
|
||||
return this._electronService.isArm64 ? WOW_RETAIL_NAME_ARM64 : WOW_RETAIL_NAME;
|
||||
}
|
||||
|
||||
private getClassicName(): string {
|
||||
return this._electronService.isArm64 ? WOW_CLASSIC_NAME_ARM64 : WOW_CLASSIC_NAME;
|
||||
}
|
||||
|
||||
private getRetailPtrName(): string {
|
||||
return this._electronService.isArm64 ? WOW_RETAIL_PTR_NAME_ARM64 : WOW_RETAIL_PTR_NAME;
|
||||
}
|
||||
|
||||
private getClassicPtrName(): string {
|
||||
return this._electronService.isArm64 ? WOW_CLASSIC_PTR_NAME_ARM64 : WOW_CLASSIC_PTR_NAME;
|
||||
}
|
||||
|
||||
private getRetailBetaName(): string {
|
||||
return this._electronService.isArm64 ? WOW_RETAIL_BETA_NAME_ARM64 : WOW_RETAIL_BETA_NAME;
|
||||
}
|
||||
|
||||
private getClassicBetaName(): string {
|
||||
return this._electronService.isArm64 ? WOW_CLASSIC_BETA_NAME_ARM64 : WOW_CLASSIC_BETA_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user