/// <summary> /// Loads required data. /// </summary> public void Load(CheckContext context) { Value = Get(context); if (context.Args.DebugMode) { Console.WriteLine($"{GetType().Name} = {Value}"); } }
/// <summary> /// Gets context value. /// </summary> public override T Get(CheckContext context) { var reader = context.Of <ConfigurationContext>(); if (m_required) { return(reader.Get <T>(m_name)); } return(reader.Get(m_name, m_default)); }
/// <summary> /// Gets context value. /// </summary> public override T Get(CheckContext context) { var reader = context.Args; if (m_required) { return(reader.Get <T>(m_name)); } return(reader.Get(m_name, m_default)); }
protected override void Run() { m_context = new CheckContext(m_args); LoadCheckers(); if (m_args.CheckIssues.Length == 0) { Console.WriteLine("No issues to check."); return; } foreach (var issue in m_args.CheckIssues) { if (!m_checkers.ContainsKey(issue)) { throw new InvalidOperationException($"Unknown issue '{issue}'."); } var checker = m_checkers[issue]; try { checker.Check(m_context); } catch (CheckException e) { throw new InvalidOperationException( $@" *** FAILED CHECK {issue} // {checker.GetType().Name} *** {e.Message} ", e); } Console.WriteLine($"{issue} // {checker.GetType().Name} > OK"); } }
/// <summary> /// Loads required data. /// </summary> public void Load(CheckContext context) { m_args = context.Args; }
/// <summary> /// Gets context value. /// </summary> public abstract T Get(CheckContext context);