107 lines
3.4 KiB
TypeScript
107 lines
3.4 KiB
TypeScript
// Module ID: 4553
|
|
// Function ID: 4554
|
|
// Name: removeExecutablePathPrefix
|
|
// Dependencies: [4416, 4554, 500, 2]
|
|
// Exports: getRunningGameAnalytics, isVerifiedGameExecutable, removeExecutablePathPrefix
|
|
|
|
// Module 4553 (removeExecutablePathPrefix)
|
|
import _openRobloxURLWithRootPlaceId from "_openRobloxURLWithRootPlaceId" /* 4554 */;
|
|
import closure_2 from "gameFromServer" /* 4416 */;
|
|
|
|
require = arg1;
|
|
const result = require("set").fileFinishedImporting("modules/game_detection/GameAnalyticsUtils.tsx");
|
|
|
|
export const removeExecutablePathPrefix = function removeExecutablePathPrefix(exePath) {
|
|
const formatted = exePath.toLowerCase();
|
|
let str = formatted;
|
|
if (formatted.endsWith("/")) {
|
|
str = formatted.slice(0, -1);
|
|
}
|
|
const parts = str.split("/");
|
|
const substr = parts.slice(-2);
|
|
return substr.join("/");
|
|
};
|
|
export const getRunningGameAnalytics = function getRunningGameAnalytics(streamApplication) {
|
|
if (null == streamApplication) {
|
|
return { gameName: "Array", gameId: "dispatch", exe: "header", distributor: "Array", sku: "isArray", gameMetadata: "isArray", rawExePath: "useState" };
|
|
} else {
|
|
const str = "exePath" in streamApplication ? streamApplication.exePath : streamApplication.exe;
|
|
let id = streamApplication.id;
|
|
let obj = { id: null, name: null, exePath: null, cmdLine: null, lastFocused: 0 };
|
|
obj[0] = id;
|
|
const name = streamApplication.name;
|
|
obj[1] = name;
|
|
let str2 = str;
|
|
if (str == null) {
|
|
str2 = "";
|
|
}
|
|
obj[2] = str2;
|
|
let str3 = str;
|
|
if (str == null) {
|
|
str3 = "";
|
|
}
|
|
obj[3] = str3;
|
|
const findGameResult = closure_2.findGame(obj);
|
|
const name2 = streamApplication.name;
|
|
obj = { gameName: null, gameId: null, exe: null, distributor: null, sku: null, gameMetadata: null, rawExePath: null };
|
|
obj[0] = name2;
|
|
let id2 = streamApplication.id;
|
|
if (id2 == null) {
|
|
id = undefined;
|
|
if (findGameResult != null) {
|
|
id = findGameResult.id;
|
|
}
|
|
id2 = id;
|
|
}
|
|
obj[1] = id2;
|
|
let joined;
|
|
if (null != str) {
|
|
const formatted = str.toLowerCase();
|
|
let str5 = formatted;
|
|
if (formatted.endsWith("/")) {
|
|
str5 = formatted.slice(0, -1);
|
|
}
|
|
const parts = str5.split("/");
|
|
const substr = parts.slice(-2);
|
|
joined = substr.join("/");
|
|
}
|
|
obj[2] = joined;
|
|
const distributor = streamApplication.distributor;
|
|
obj[3] = distributor;
|
|
const sku = streamApplication.sku;
|
|
obj[4] = sku;
|
|
let subgameMetadata;
|
|
if (null != streamApplication) {
|
|
subgameMetadata = _openRobloxURLWithRootPlaceId.getSubgameMetadata(streamApplication);
|
|
const obj4 = _openRobloxURLWithRootPlaceId;
|
|
}
|
|
obj[5] = subgameMetadata;
|
|
obj[6] = str;
|
|
return obj;
|
|
}
|
|
};
|
|
export const isVerifiedGameExecutable = function isVerifiedGameExecutable(str, arr) {
|
|
if (null != str) {
|
|
if (null != arr) {
|
|
const formatted = str.toLowerCase();
|
|
let substr = formatted;
|
|
if (formatted.endsWith("/")) {
|
|
substr = formatted.slice(0, -1);
|
|
}
|
|
dependencyMap = substr(500).getPlatformName();
|
|
return arr.some((os) => {
|
|
let tmp = os.os === closure_1;
|
|
if (tmp) {
|
|
let endsWithResult;
|
|
if (substr != null) {
|
|
endsWithResult = obj.endsWith(os.name);
|
|
}
|
|
tmp = endsWithResult;
|
|
obj = substr;
|
|
}
|
|
return tmp;
|
|
});
|
|
}
|
|
}
|
|
return false;
|
|
};
|