// /** // * File: SkyCheck.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using ln.skyscanner.entities; using System.IO; using System.Collections.Generic; namespace ln.skyscanner.checks { public abstract class SkyCheck { /* Static */ static List skyChecks = new List(); public static SkyCheck[] SkyChecks => skyChecks.ToArray(); public static void AddSkyCheck(SkyCheck skyCheck) => skyChecks.Add(skyCheck); /* Instance */ public SkyCheck(String checkName) { Name = checkName; } public string Name { get; } public virtual bool IsCritical => false; public abstract bool IsValid(Node node); public abstract void Check(SkyChecker skyChecker,ref SkyCheckState checkState,Node node); public virtual void SetState(SkyCheckState checkState,double value) { if ((value < checkState.CritLower) || (value > checkState.CritUpper)) { checkState.CheckState = CheckState.CRITICAL; } else if ((value < checkState.WarnLower) || (value > checkState.WarnUpper)) { checkState.CheckState = CheckState.WARN; } else { checkState.CheckState = CheckState.OK; } } static SkyCheck() { AddSkyCheck(new Hostalive()); AddSkyCheck(new Ubiquity()); } } }