public override double Check() { if (_context.Study.NeedExclusion == ExclusionType.Undefined) { IsDirty = false; return(0); } _type = _context.Study.NeedExclusion; return(1); }
private bool CheckExclusion(ExclusionType ex, IReadOnlyCollection <Regex> patterns, ITranslatedNamedGetter a) { if (ex == ExclusionType.Name || ex == ExclusionType.Full) { if (a.Name == null || !a.Name !.TryLookup(Language.English, out var name)) { return(false); } return(CheckExclusionName(patterns, name)); } return(CheckExclusionMajorRecord(ex, patterns, (IMajorRecordGetter)a)); }
public static void AddExclusion(TechType excludedTank, bool bExcludeMultipliers, bool bExcludeOverride) { ExclusionType newExclusion = (ExclusionType)((bExcludeMultipliers ? 1 : 0) + (bExcludeOverride ? 2 : 0)); if (Exclusions.ContainsKey(excludedTank)) { Logger.Log(Logger.Level.Debug, $"Modifying exclusion for TechType.{excludedTank} to {newExclusion.ToString()}"); Exclusions[excludedTank] = (ExclusionType)newExclusion; return; } Logger.Log(Logger.Level.Debug, $"Assigning new exclusion for TechType.{excludedTank} as {newExclusion.ToString()}"); Exclusions.Add(excludedTank, (ExclusionType)newExclusion); }
public Exclusion GetExclusion(ExclusionType type, int?level = null) { var exclusions = _exclusionStore.GetAll().Where(d => d.Types.Contains(type)); if (level.HasValue) { exclusions = exclusions.Where(d => d.Level == level || d.Level <= 0); } int?index = _generator.IndexByCoefficients(exclusions.Select(x => x.Coefficient).ToList()); return(index == null ? null : exclusions.ToList()[index.Value]); }
private bool CheckExclusionMajorRecord(ExclusionType e, IReadOnlyCollection <Regex> patterns, IMajorRecordGetter m) { var fis = m.FormKey.ID.ToString("X8"); if (!patterns.Any()) { return(false); } return(e switch { ExclusionType.Name => throw new NotImplementedException("Should have been handled elsewhere"), ExclusionType.EDID => m.EditorID != null && patterns.Any(p => p.IsMatch(m.EditorID !)), ExclusionType.ModName => patterns.Any(p => p.IsMatch(m.FormKey.ModKey.FileName)), ExclusionType.Full => throw new NotImplementedException("Should have been handled elsewhere"), ExclusionType.FormID => patterns.Any(p => p.IsMatch(fis)), _ => throw new ArgumentOutOfRangeException(nameof(e), e, null) });
public BaseCheck(ExclusionType exclusionType = ExclusionType.Undefined, List <ICheckStep> checkSteps = null) { if (checkSteps != null) { ICheckStep lastStep = null; foreach (var step in checkSteps) { if (lastStep != null) { lastStep.SetNextStep(step); } else { CheckChain = step; lastStep = CheckChain; continue; } lastStep = step; } } ExclusionType = exclusionType; }
public FrameworkExclusion(ExclusionType exclusionType, string simpleName, string reason) { ExclusionType = exclusionType; SimpleName = simpleName; Reason = reason; }
public virtual void Deduct(ExclusionType exclusion) { OnDeduct?.Invoke(exclusion); ContextChanged(); }
public Exclusion(ExclusionType type, string pattern) { Type = type; Pattern = pattern; }
public ExclusionTypeModel(ExclusionType model) : base(model) { Code = model.Code; System = model.System; }