exports.__esModule = true; exports.Icons = void 0; var fs_1 = require("fs"); var path = require("path"); var Logger_1 = require("./Logger"); var Icons = /** @class */ (function () { function Icons() { this.materialPath = path.join(__filename, '..', '..', '..', 'Static', 'materialicons'); this.icons = []; this.iconIDs = []; } Icons.prototype.load = function (callback) { var _this = this; Logger_1.Log('info', 'Loading icons'); fs_1.readdir(path.join(this.materialPath, 'black'), function (err, files) { if (err) throw err; for (var i = 0; i < files.length; i++) { if (files[i].includes('.png') && !files[i].includes('_low')) { var fileID = files[i].replace('.png', ''); _this.iconIDs.push(fileID); _this.icons.push({ id: fileID, name: fileID.replace(/_/g, ' ') }); } } Logger_1.Log('info', "Loaded " + files.length + " icon(s)"); callback(); }); }; Icons.prototype.getList = function () { return this.icons; }; Icons.prototype.getPath = function (iconID, style) { if (this.iconIDs.includes(iconID)) return path.join(this.materialPath, style, iconID + ".png"); console.log("Invalid icon '" + iconID + "'"); return null; }; return Icons; }()); exports.Icons = Icons; // export interface Icons { // load: (callback: () => void) => void; // getList: () => { id: string; name: string }[]; // getPath: (iconID: string, style: 'black' | 'white') => string; // } //# sourceMappingURL=Icons.js.map