Пример #1
0
        public static IHostBuilder CreateHostBuilder(string[] args, string[] urls, string pathToken, string pathFile, ProgramAction action)
        {
            var Dict = new Dictionary <string, string>
            {
                { "PathToken", pathToken },
                { "PathFile", pathFile },
                { "Action", action.ToString() }
            };

            return(Host.CreateDefaultBuilder(args)
                   .ConfigureAppConfiguration((hostingContext, config) =>
            {
                config.AddInMemoryCollection(Dict);
            })
                   .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseWebRoot("wwwroot");
                webBuilder.UseStartup <Startup>();
                webBuilder.UseUrls(urls);
            }));
        }
Пример #2
0
        public static void InputLoop()
        {
            while (true)
            {
                string   command = Console.ReadLine().ToLower();
                string[] splits  = command.Split(' ');

                if (splits[0] == "action")
                {
                    if (splits.Length >= 2)
                    {
                        if (splits[1] == "slave")
                        {
                            Action = ProgramAction.Action_PopSlave;
                        }
                        else if (splits[1] == "mix")
                        {
                            Action = ProgramAction.Action_PopSlaveThenApply;
                        }
                        else if (splits[1] == "full")
                        {
                            Action = ProgramAction.Action_Full;
                        }
                    }

                    AddToConsole("ProgramAction is " + Action.ToString());
                }
                else if (splits[0] == "start")
                {
                    RenderTimer = 10000;
                    if (splits.Length >= 2)
                    {
                        try
                        {
                            RenderTimer = Convert.ToInt16(splits[1]) * 1000;
                        }
                        catch
                        {
                            AddToConsole("Incorrect format.");
                            continue;
                        }
                    }
                    Logging.StartEmailLogLoop(5 * 60 * 1000);
                    Status = ProgramStatus.Program_Idle;
                    AddToConsole("AUTOCLAVE Started");
                    Cycle();
                }
                else if (command == "slave")
                {
                    if (Slave != null)
                    {
                        Slave.Close();
                    }

                    Status = ProgramStatus.Program_Idle;

                    Slave          = new SequentialSlave();
                    Slave.Sequence = NumbersList;
                    SystemSounds.Exclamation.Play();

                    Slave.ShowDialog();

                    NumbersList.Clear();
                }
                else
                {
                    AddToConsole("\'" + command + "\' not recognized.");
                }
            }
        }