| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using System;
- using AtomicEngine;
- namespace AtomicTools
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- // create the service
- var app = NETServiceApplication.Create();
- // Subscribe to IPC NET commands
- app.SubscribeToEvent("IPCCmd", (eventType, eventData) =>
- {
- // get the command
- string command = eventData["command"];
- switch (command)
- {
- // parse assembly for component information
- case "parse":
- // Get the assembly to parse
- string assemblyPath = eventData["assemblyPath"];
- // Inspect the assembly for components
- var assemblyJSON = AtomicTools.InspectAssembly(assemblyPath);
- // Return result
- var vmap = new ScriptVariantMap();
- // FIXME: update index operator to a generic
- vmap.SetUInt("id", eventData.GetUInt("id"));
- vmap["command"] = command;
- vmap["result"] = assemblyJSON;
- AtomicNET.GetSubsystem<IPC>().SendEventToBroker("IPCCmdResult", vmap);
- break;
- // exit service
- case "exit":
- app.SendEvent("ExitRequested");
- break;
- }
- });
- // Managed code in charge of main loop
- while (app.RunFrame())
- {
- }
- // Shut 'er down
- app.Shutdown();
- }
- }
- }
|