Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
117 lines
3.8 KiB
TypeScript
117 lines
3.8 KiB
TypeScript
// Module ID: 4734
|
|
// Function ID: 4735
|
|
// Name: GameAnalyticsUtils
|
|
// Dependencies: [1931, 4735, 1115, 2]
|
|
// Exports: getGameAnalyticsMetadata, getRunningGameAnalytics, isVerifiedGameExecutable, removeExecutablePathPrefix
|
|
|
|
// Module 4734 (GameAnalyticsUtils)
|
|
import PlatformUtils from "PlatformUtils" /* 1115 */;
|
|
import RobloxSubgameUtils from "RobloxSubgameUtils" /* 4735 */;
|
|
import DetectableGameStore from "DetectableGameStore" /* 1931 */;
|
|
|
|
require = fn;
|
|
const size = fn(2);
|
|
const result = size.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: "call", gameId: "shapes", exe: "index", distributor: "fill", sku: "Map", gameMetadata: "channel", rawExePath: "hash" };
|
|
} else {
|
|
const str = "exePath" in streamApplication ? streamApplication.exePath : streamApplication.exe;
|
|
const id = streamApplication.id;
|
|
const obj = { id, name: null, exePath: null, cmdLine: null, lastFocused: 0 };
|
|
const name = streamApplication.name;
|
|
obj.name = name;
|
|
let str2 = str;
|
|
if (str == null) {
|
|
str2 = "";
|
|
}
|
|
obj.exePath = str2;
|
|
let str3 = str;
|
|
if (str == null) {
|
|
str3 = "";
|
|
}
|
|
obj.cmdLine = str3;
|
|
const findGameResult = DetectableGameStore.findGame(obj);
|
|
const name2 = streamApplication.name;
|
|
const obj2 = { gameName: name2, gameId: null, exe: null, distributor: null, sku: null, gameMetadata: null, rawExePath: null };
|
|
let id2 = streamApplication.id;
|
|
if (id2 == null) {
|
|
let id1;
|
|
if (findGameResult != null) {
|
|
id1 = findGameResult.id;
|
|
}
|
|
id2 = id1;
|
|
}
|
|
obj2.gameId = 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("/");
|
|
}
|
|
obj2.exe = joined;
|
|
const distributor = streamApplication.distributor;
|
|
obj2.distributor = distributor;
|
|
const sku = streamApplication.sku;
|
|
obj2.sku = sku;
|
|
let subgameMetadata;
|
|
if (null != streamApplication) {
|
|
subgameMetadata = RobloxSubgameUtils.getSubgameMetadata(streamApplication);
|
|
}
|
|
obj2.gameMetadata = subgameMetadata;
|
|
obj2.rawExePath = str;
|
|
return obj2;
|
|
}
|
|
};
|
|
export const getGameAnalyticsMetadata = function getGameAnalyticsMetadata(currentGameForAnalytics, arg1, detected_game_id) {
|
|
if (arg1) {
|
|
if (null != detected_game_id) {
|
|
const _JSON = JSON;
|
|
const obj2 = { detected_game_id };
|
|
let json = JSON.stringify(obj2);
|
|
}
|
|
return json;
|
|
}
|
|
json = RobloxSubgameUtils.getSubgameMetadata(currentGameForAnalytics);
|
|
};
|
|
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);
|
|
}
|
|
const platformName = PlatformUtils.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;
|
|
};
|