Ejemplo n.º 1
0
 public override double Check()
 {
     if (_context.Study.NeedExclusion == ExclusionType.Undefined)
     {
         IsDirty = false;
         return(0);
     }
     _type = _context.Study.NeedExclusion;
     return(1);
 }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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]);
        }
Ejemplo n.º 5
0
        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)
            });
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 public FrameworkExclusion(ExclusionType exclusionType, string simpleName, string reason)
 {
     ExclusionType = exclusionType;
     SimpleName    = simpleName;
     Reason        = reason;
 }
Ejemplo n.º 8
0
 public virtual void Deduct(ExclusionType exclusion)
 {
     OnDeduct?.Invoke(exclusion);
     ContextChanged();
 }
Ejemplo n.º 9
0
 public Exclusion(ExclusionType type, string pattern)
 {
     Type    = type;
     Pattern = pattern;
 }
Ejemplo n.º 10
0
 public ExclusionTypeModel(ExclusionType model) : base(model)
 {
     Code   = model.Code;
     System = model.System;
 }