Server/project/src/Program.ts
Alex d13e86ba46 Rebranding to SPT (!345)
Rebranded src code and scripts to SPT

Co-authored-by: clodan <clodan@clodan.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/345
Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com>
Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
2024-05-21 17:59:04 +00:00

41 lines
1.3 KiB
TypeScript

import { container } from "tsyringe";
import { Container } from "@spt/di/Container";
import { ErrorHandler } from "@spt/ErrorHandler";
import type { PreSptModLoader } from "@spt/loaders/PreSptModLoader";
import { App } from "@spt/utils/App";
import { Watermark } from "@spt/utils/Watermark";
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));
}
}
}