import { Equal } from "typeorm";
|
|
import connectToDatabase from "./database";
|
|
import IpcInterface from "./services/IpcInterface";
|
|
import TorrentClient from "./services/TorrentClient";
|
|
|
|
export default class Application
|
|
{
|
|
/**
|
|
* The torrent client instance
|
|
*/
|
|
private __client: TorrentClient;
|
|
|
|
/**
|
|
* The IPC interface for the torrent client
|
|
*/
|
|
private __ipcInterface: IpcInterface;
|
|
|
|
/**
|
|
* Create the application
|
|
*/
|
|
public constructor() {
|
|
this.__client = new TorrentClient();
|
|
this.__ipcInterface = new IpcInterface(this.__client);
|
|
}
|
|
|
|
/**
|
|
* Boot the application services
|
|
*/
|
|
private async boot() {
|
|
await connectToDatabase();
|
|
await this.__client.boot();
|
|
await this.__ipcInterface.boot();
|
|
}
|
|
|
|
/**
|
|
* Start and run the application
|
|
*/
|
|
public async exec() {
|
|
await this.boot();
|
|
console.log("Torrent client ready");
|
|
}
|
|
|
|
/**
|
|
* Get the torrent client instance
|
|
*/
|
|
public get torrentClient() {
|
|
return this.__client;
|
|
}
|
|
}
|