Server/project/src/Program.ts
Refringe 5740774a46
Apply Biome Formatting
This is the result of running `npm run format` which applies the Biome formatting rules. Rejoice!
2024-07-23 11:12:53 -04:00

35 lines
1.3 KiB
TypeScript

import { ErrorHandler } from "@spt/ErrorHandler";
import { Container } from "@spt/di/Container";
import type { PreSptModLoader } from "@spt/loaders/PreSptModLoader";
import { App } from "@spt/utils/App";
import { Watermark } from "@spt/utils/Watermark";
import { container } from "tsyringe";
export class Program {
private errorHandler: ErrorHandler;
constructor() {
// set window properties
process.stdout.setEncoding("utf8");
process.title = "SPT Server";
this.errorHandler = new ErrorHandler();
}
public async start(): Promise<void> {
try {
Container.registerTypes(container);
const childContainer = container.createChildContainer();
const watermark = childContainer.resolve<Watermark>("Watermark");
watermark.initialize();
const preSptModLoader = childContainer.resolve<PreSptModLoader>("PreSptModLoader");
Container.registerListTypes(childContainer);
await preSptModLoader.load(childContainer);
Container.registerPostLoadTypes(container, childContainer);
childContainer.resolve<App>("App").load();
} catch (err: any) {
this.errorHandler.handleCriticalError(err instanceof Error ? err : new Error(err));
}
}
}