public static string[] ShowDefCfgLines(Config cfg) { string[] x = new string[100]; int ix = 0; x[ix++] = ""; string[] a; a = LMAcquireConfig.ToLines(cfg, cfg.acq); for (int i = 0; i < a.Length; i++) x[ix++] = a[i]; x[ix++] = ""; a = cfg.app.ToLines(); for (int i = 0; i < a.Length; i++) x[ix++] = a[i]; x[ix++] = ""; a = cfg.netcomm.ToLines(); for (int i = 0; i < a.Length; i++) x[ix++] = a[i]; x[ix++] = ""; a = cfg.db.ToLines(); for (int i = 0; i < a.Length; i++) x[ix++] = a[i]; x[ix++] = ""; Array.Resize(ref x, ix); return x; }
public bool Initialize(Config cfg) { this.cfg = cfg; bool good = cfg.ParseCommandShellArgs();// override defaults and stored config values with flags from the command line if (good) { cfg.CmdLineActionOverride(); // override default file input setting with active command action (if any) from cmd line name = Config.AppName; Opstate.Action = (NCCAction)cfg.Cur.Action; // command line flag can set this, the override above makes sure the cmd line is the state loggers = new LMLoggers(cfg); pest.logger = Logger(LMLoggers.AppSection.DB); } return good; }
public static void ShowCfg(Config cfg, bool full) { string[] x = ShowCfgLines(cfg, full, false); for (int i = 0; i < x.Length; i++) Console.WriteLine(x[i]); }
public static string[] ShowCfgLines(Config cfg, bool fullAssembly, bool flush) { string[] x = new string[4096]; int ix = 0; x[ix++] = ""; string[] v = cfg.ShowVersionLines(fullAssembly); for (int i = 0; i < v.Length; i++) x[ix++] = v[i]; if (flush) { cfg.RetainChanges(); } string[] a = new string[0]; string[] b = new string[0]; bool richcontent = (cfg.acq.IncludeConfig || cfg.cmd.Showcfg); Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (config.HasFile) { x[ix++] = ("Config source: " + config.FilePath); if (richcontent) { a = cfg.ShowAppCfgLines(); for (int i = 0; i < a.Length; i++) x[ix++] = a[i]; } } //else { if (richcontent) { x[ix++] = ""; x[ix++] = ("Config values from database, command line overrides and system defaults"); b = ShowDefCfgLines(cfg); for (int i = 0; i < b.Length; i++) x[ix++] = b[i]; } } x[ix++] = ""; Array.Resize(ref x, ix); return x; }
public void ShowVersionOnConsole(Config me, bool full) { string[] x = me.ShowVersionLines(full); for (int i = 0; i < x.Length; i++) Console.WriteLine(x[i]); }
public static string[] ToLines(Config cfg, LMAcquireConfig c) { string[] x = new string[100]; int ix = 0; if (c.LM >= 0) x[ix++] = " LMMM LM #: " + c.LM; x[ix++] = " annotation message: " + "'" + c.Message + "'"; //x[ix++] = " raw NCD file location: " + (cfg == null ? c.Raw : cfg.Raw); fix lameness //x[ix++] = " results file location: " + (cfg == null ? c.Results : cfg.Results); if (c.IncludeConfig) x[ix++] = " append app config content to results file"; x[ix++] = ""; x[ix++] = " assay cycles: " + c.Cycles; x[ix++] = " assay cycle interval: " + c.Interval + " seconds"; x[ix++] = " assay cycle separation: " + c.Separation + " ms"; x[ix++] = " assay feedback flag: " + c.Feedback; x[ix++] = " assay type: " + c.PoliteName(c.AssayType); if (c.SaveOnTerminate) x[ix++] = " SaveOnTerminate: on cancellation or DAQ error, preserve results"; else x[ix++] = " SaveOnTerminate: on cancellation or DAQ error, abandon results"; x[ix++] = ""; x[ix++] = " HV calib minHV, maxHV, step: " + c.MinHV + ", " + c.MaxHV + ", " + c.Step + " volts"; x[ix++] = " HV calib step and delay duration: " + c.HVDuration + ", " + c.Delay + " seconds"; if (c.HVX) x[ix++] = " HV calib push to Excel enabled"; Array.Resize(ref x, ix); return x; }
internal void SetupCountingAnalyzerHandler(Config cfg, double tickSizeInSeconds, RawAnalyzerHandler.AnalysesCompleted f = null, RawAnalyzerHandler.NeutronOutOfSequenceErrorEvent f2 = null, RawAnalyzerHandler.BlockCountMismatchErrorEvent f3 = null) { State.Sup.SetLogger(analogger); if (f == null) // use the local handle State.Sup.Construct((string s) => { AssayPendingComplete(); logger.TraceEvent(LogLevels.Info, 139, "Neutron counting: '" + s + "'"); }, (string s) => { AssayPendingComplete(); logger.TraceEvent(LogLevels.Error, 138, "Neutron counting processing stopped with error: '" + s + "'"); EndAnalysisImmediately(); throw new FatalNeutronCountingException(s); // emergency exit, caught and noted in buffer handler PassToAnalysis }, (string s) => { AssayPendingComplete(); logger.TraceEvent(LogLevels.Error, 137, "Neutron counting processing [Block] stopped with error: '" + s + "'"); EndAnalysisImmediately(); throw new FatalNeutronCountingException(s); // emergency exit, caught and noted in buffer handler PassToAnalysis }, theTicSizeInSeconds: tickSizeInSeconds, csa: NC.App.Opstate.CancelStopAbort); // starts the threads, so watch out! else State.Sup.Construct(f, f2, f3, theTicSizeInSeconds: tickSizeInSeconds, csa: NC.App.Opstate.CancelStopAbort); // ditto logger.TraceEvent(LogLevels.Verbose, 146, "Neutron counting task running, {0} time base", tickSizeInSeconds); }
public static string[] ShowCfgLines(Config cfg, bool fullAssembly, bool flush) { string[] x = new string[4096]; int ix = 0; x[ix++] = ""; string[] a = cfg.ShowVersionLines(fullAssembly); for (int i = 0; i < a.Length; i++) x[ix++] = a[i]; if (flush) { cfg.RetainChanges(); } a = new string[0]; bool richcontent = (cfg.acq.IncludeConfig || cfg.cmd.Showcfg); System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (config.HasFile) { x[ix++] = ("Config source: " + config.FilePath); if (richcontent) a = cfg.ShowAppCfgLines(); } else { x[ix++] = ("Config source from internal default values"); if (richcontent) a = ShowDefCfgLines(cfg); } if (richcontent) for (int i = 0; i < a.Length; i++) x[ix++] = a[i]; x[ix++] = ""; Array.Resize(ref x, ix); return x; }
public bool Initialize(Config cfg) { this.cfg = cfg; bool good = cfg.ParseCommandShellArgs();// override defaults and stored config values with flags from the command line if (good) { cfg.CmdLineActionOverride(); // override default file input setting with active command action (if any) from cmd line name = Config.AppName; Opstate.Action = (NCCAction)cfg.Cur.Action; // command line flag can set this, the override above makes sure the cmd line is the state loggers = new LMLoggers(cfg); pest.logger = Logger(LMLoggers.AppSection.DB); if (!String.IsNullOrEmpty(cfg.Cur.Detector) && !cfg.Cur.Detector.Equals("Default")) // command line set the value IntegrationHelpers.SetNewCurrentDetector(cfg.Cur.Detector); } return good; }