Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async finishTest() {
IModelHost.shutdown();
// Electron only
if (app !== undefined) app.exit();
// Browser only
if (DisplayPerfRpcInterface.webServer) DisplayPerfRpcInterface.webServer.close();
if (DisplayPerfRpcInterface.backendServer) DisplayPerfRpcInterface.backendServer.close();
if (DisplayPerfRpcInterface.chrome) await DisplayPerfRpcInterface.chrome.kill();
}
export const terminate = (frontendApp = IModelApp) => {
if (!isInitialized)
return;
// store directory that needs to be cleaned-up
const tempDirectory = (PresentationBackend.initProps && PresentationBackend.initProps.id)
? path.join(KnownLocations.tmpdir, "ecpresentation", PresentationBackend.initProps.id) : undefined;
// terminate backend
PresentationBackend.terminate();
IModelHost.shutdown();
if (tempDirectory)
rimraf.sync(tempDirectory);
// terminate frontend
PresentationFrontend.terminate();
frontendApp.shutdown();
isInitialized = false;
isFrontendAppInitialized = false;
};
public async restartIModelHost(): Promise {
IModelHost.shutdown();
IModelHost.startup();
}
importer.import().then(() => {
process.stdout.write("IModel: " + argv.output + " Created for GeoJson: " + argv.input + "\n");
IModelHost.shutdown();
}).catch(() => {
process.stdout.write("Error occurred\n");
import { AnalysisImporter } from "./AnalysisImporter";
import * as path from "path";
import * as fs from "fs";
IModelHost.startup();
Logger.initializeToConsole();
const outputDir = path.join(__dirname, "output");
const dbName = path.join(outputDir, "AnalysisExample.bim");
fs.mkdir(outputDir, ((_err) => { }));
fs.unlink(dbName, ((_err) => { }));
const importer = new AnalysisImporter(dbName);
importer.import();
IModelHost.shutdown();
.string("name")
.describe("name", "Name (displayed in GUI and tool tip)")
.demandOption(["input", "output"])
.argv;
IModelHost.startup();
Logger.initializeToConsole();
const creator = new RealityModelContextIModelCreator(argv.output as string, argv.input as string, argv.name as string);
creator.create().then(() => {
process.stdout.write("IModel: " + argv.output + " Created for Reality Model: " + argv.input);
}).catch(() => {
process.stdout.write("Error occurred creating IModel\n");
});
IModelHost.shutdown();
TestRpcImpl2.instantiate();
event.returnValue = true;
} else if (msg.name === CONSTANTS.REPLACE_TEST_RPCIMPL2_INSTANCE_MESSAGE) {
TestRpcImpl2.instantiate();
event.returnValue = true;
} else if (msg.name === CONSTANTS.UNREGISTER_TEST_RPCIMPL2_CLASS_MESSAGE) {
TestRpcImpl2.unregister();
event.returnValue = true;
} else if (msg.name === CONSTANTS.SET_INCOMPATIBLE_INTERFACE_VERSION) {
IModelReadRpcInterface.version = "0.0.0";
event.returnValue = true;
} else if (msg.name === CONSTANTS.RESTORE_COMPATIBLE_INTERFACE_VERSION) {
IModelReadRpcInterface.version = compatibleVersion;
event.returnValue = true;
} else if (msg.name === CONSTANTS.RESTART_BACKEND) {
IModelHost.shutdown();
IModelHost.startup();
event.returnValue = true;
} else if (msg.name === CONSTANTS.RESET_OP8_INITIALIZER) {
resetOp8Initializer();
event.returnValue = true;
}
}
public static shutdown() {
IModelHost.shutdown();
}
}