igir
Version:
🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.
71 lines (70 loc) • 2.27 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result) __defProp(target, key, result);
return result;
};
import { Expose, plainToClassFromExist, Transform, Type } from "class-transformer";
import DAT from "../dat.js";
import Header from "../logiqx/header.js";
import SoftwareListDAT from "./softwareListDat.js";
const _SoftwareListsDAT = class _SoftwareListsDAT extends DAT {
softwarelist;
constructor(props) {
super(props);
this.softwarelist = props?.softwarelist;
this.generateGameNamesToParents();
}
/**
* Construct a {@link SoftwareListsDAT} from a generic object, such as one from reading an XML
* file.
*/
static fromObject(obj, props) {
const dat = new _SoftwareListsDAT(props);
return plainToClassFromExist(dat, obj, {
enableImplicitConversion: true,
excludeExtraneousValues: true
}).generateGameNamesToParents();
}
getHeader() {
return new Header({
name: this.getSoftwareLists().map((softwareList) => softwareList.getName()).join(", "),
description: this.getSoftwareLists().map((softwareList) => softwareList.getDescription()).join(", ")
});
}
getSoftwareLists() {
if (this.softwarelist === void 0) {
return [];
}
if (Array.isArray(this.softwarelist)) {
return this.softwarelist;
}
return [this.softwarelist];
}
getGames() {
return this.getSoftwareLists().flatMap((softwareList) => softwareList.getGames());
}
/**
* @inheritdoc
*/
isMame() {
return true;
}
withGames(games) {
return new SoftwareListDAT({ ...this, software: games });
}
};
__decorateClass([
Expose(),
Type(() => SoftwareListDAT),
Transform(({ value }) => value ?? [])
], _SoftwareListsDAT.prototype, "softwarelist", 2);
let SoftwareListsDAT = _SoftwareListsDAT;
export {
SoftwareListsDAT as default
};
//# sourceMappingURL=softwareListsDat.js.map