using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace Seikactl { class Opts { public bool isActive { get; } public bool isProdScan { get; } public bool isBootHttpSrv { get; } public bool isASWaitBoot { get; } public int ASWaitTime { get; } public bool isASShutdown { get; } public bool isASStartup { get; } public string ASBootPath { get; } public Opts(string[] args) { isActive = false; isProdScan = false; isBootHttpSrv = false; isASWaitBoot = false; isASStartup = false; isASShutdown = false; ASWaitTime = 180; if (args.Length == 0) { Console.WriteLine("Seikactl 20230319/u"); Console.WriteLine(""); Console.WriteLine("usage: Seikactl < boot PATH | waitboot [N] | prodscan | boothttp | shutdown >"); Console.WriteLine(@" boot : Start AssistantSeika from PATH."); Console.WriteLine(@" waitboot : Wait N seconds for AssistantSeika to start. default Wait 180 seconds."); Console.WriteLine(@" prodscan : Run a ""product scan"". Note: Do not run continuously. "); Console.WriteLine(@" boothttp : Run or reboot ""HTTP Service""."); Console.WriteLine(@" shutdown : Shutdown AssistantSeika."); Console.WriteLine(""); } else { try { switch (args[0]) { case "prodscan": isProdScan = true; break; case "boothttp": isBootHttpSrv = true; break; case "waitboot": isASWaitBoot = true; if (args.Length == 2) { ASWaitTime = int.Parse(args[1]); } break; case "boot": isASStartup = true; if (args.Length == 2) { ASBootPath = args[1]; } else { Console.WriteLine("need PATH."); } break; case "shutdown": isASShutdown = true; break; default: Console.WriteLine("unknown {0}", args[0]); break; } if (isProdScan || isBootHttpSrv || isASWaitBoot || isASShutdown || isASStartup) { isActive = true; } } catch (Exception e) { Console.WriteLine("err:{0}", e.Message); isActive = false; } } } } }