Exemple #1
0
        static async Task Main(string[] args)
        {
            var parms = ParseArgs(args);
            var errs  = new StringBuilder();

            if (!parms.ContainsKey("orgid"))
            {
                errs.AppendLine("Missing -uid argument - Organization Id");
            }
            if (!parms.ContainsKey("org"))
            {
                errs.AppendLine("Missing -usrname argument - Organization Name");
            }
            if (!parms.ContainsKey("uid"))
            {
                errs.AppendLine("Missing -uid argument - User Id");
            }
            if (!parms.ContainsKey("usrname"))
            {
                errs.AppendLine("Missing -usrname argument - User Name");
            }
            if (!parms.ContainsKey("id"))
            {
                errs.AppendLine("Missing -id argument - Id of the Simulator Network");
            }
            if (!parms.ContainsKey("key"))
            {
                errs.AppendLine("Missing -keyargument - Simulator Network Key");
            }

            if (errs.Length > 0)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(errs.ToString());
                Console.ResetColor();
                return;
            }

            Console.WriteLine($"Starting simulator network for: {parms["id"]}");

            var org = EntityHeader.Create(parms["orgid"], parms["org"]);
            var usr = EntityHeader.Create(parms["uid"], parms["usrname"]);
            var id  = parms["id"];
            var key = parms["key"];

            var mgr = new SimulatorRuntimeManager(new SimulatorRuntimeServicesFactory(), new AdminLogger(new LogWriter()));

            mgr.Publisher = new NotificationPublisher();
            await mgr.InitAsync(id, key, org, usr, Core.Interfaces.Environments.Development);

            Console.ReadKey();
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            _serviceCollection = services;
            _simRuntimeManager = new SimulatorRuntimeManager(new SimulatorRuntimeServicesFactory(), new AdminLogger(new LogWriter()));
            _serviceCollection.AddSingleton(_simRuntimeManager);

            services.AddSignalR();

            services.AddControllersWithViews();

            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });

            services.AddCors(options =>
                             options.AddPolicy(_corsPolicy,
                                               bldr => bldr.WithOrigins("http://localhost:4200", "http://localhost:5000", "http://localhost:4201")
                                               .AllowAnyMethod()
                                               .AllowCredentials()
                                               .AllowAnyHeader()
                                               ));
        }
Exemple #3
0
 public NotificationHub(SimulatorRuntimeManager mgr)
 {
     _mgr = mgr;
 }
 public SimulatorController(IHubContext <NotificationHub> hub, SimulatorRuntimeManager simulatorRuntimeManager)
 {
     _hub = hub;
     _simulatorRuntimeManager = simulatorRuntimeManager;
 }