public ParameterConditional(Parameter compared, Parameter compareTo, WarningType warningType, string description = null)
 {
     this.compared = compared;
     this.compareTo = compareTo;
     this.warningType = warningType;
     this.description = description;
 }
Ejemplo n.º 2
0
 private string GetWarningLocale(WarningType warningType)
 {
     switch (warningType)
     {
         case WarningType.INVALID_TARGET:
             return "Invalid target";
         case WarningType.INVALID_PARAMETER:
             return "Invalid parameter";
         case WarningType.INVALID_VALUE:
             return "Invalid parameter value";
     }
     return "Other error "+warningType.ToString();
 }
        public WarningEvaluator(TimeSpan warningBefore, WarningType type)
        {
            switch (type)
            {
                case WarningType.RuneSpawn:
                    spawnTime = RUNE_SPAWN_TIME;
                    break;
                case WarningType.NeutralCreepSpawn:
                    spawnTime = NEUTRAL_SPAWN_TIME;
                    break;
                default:
                    throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            _warningAt = spawnTime - (int)warningBefore.TotalSeconds;
        }
 protected void OnWarning(string message, string content, WarningType type = WarningType.Other)
 {
     if (WarningOccured != null)
         WarningOccured(this, new WarningArgs(message, content, type));
 }
 public ParameterConditional(Parameter compared, int value, WarningType warningType, string description = null)
     : this(compared, new Parameter(value.ToString(), value), warningType, description)
 {
 }
 public ParameterConditional(Parameter compared, WarningType warningType)
 {
     this.compared = compared;
     this.warningType = warningType;
 }
    private double GetScoreForWarningType(WarningType warningType)
    {
      switch (warningType)
      {
        #region All the cases ...
        case WarningType.ArithmeticDivisionByZero:
          return ScoreArithmeticDivisionByZero;

        case WarningType.ArithmeticDivisionOverflow:
          return ScoreArithmeticDivisionOverflow;

        case WarningType.ArithmeticMinValueNegation:
          return ScoreArithmeticMinValueNegation;

        case WarningType.ArithmeticFloatEqualityPrecisionMismatch:
          return ScoreArithmeticFloatEqualityPrecisionMismatch;

        case WarningType.ArithmeticOverflow:
        case WarningType.ArithmeticUnderflow:
          return ScoreArithmeticOverflow;

        case WarningType.ArrayCreation:
          return ScoreArrayCreation;

        case WarningType.ArrayLowerBound:
          return ScoreArrayLowerBound;

        case WarningType.ArrayUpperBound:
          return ScoreArrayUpperBound;

        case WarningType.ArrayPurity:
          return ScoreArrayPurity;

        case WarningType.ClousotCacheNotAvailable:
          return ScoreClousotCacheNotAvailable;

        case WarningType.ContractAssert:
          return ScoreContractAssert;

        case WarningType.ContractEnsures:
          return ScoreContractEnsures;

        case WarningType.ContractInvariant:
          return ScoreContractInvariant;

        case WarningType.ContractRequires:
          return ScoreContractRequires;

        case WarningType.EnumRange:
          return ScoreEnumRange;

        case WarningType.MissingPrecondition:
          return ScoreMissingPrecondition;

        case WarningType.MissingPreconditionInvolvingReadonly:
          return ScoreMissingPreconditionInvolvingReadonly;

        case WarningType.Suggestion:
          return ScoreSuggestion;

        case WarningType.NonnullArray:
          return ScoreNonnullArray;

        case WarningType.NonnullCall:
          return ScoreNonnullCall;

        case WarningType.NonnullField:
          return ScoreNonnullField;

        case WarningType.NonnullUnbox:
          return ScoreNonnullUnbox;

        case WarningType.UnsafeCreation:
          return ScoreUnsafeCreation;

        case WarningType.UnsafeLowerBound:
          return ScoreUnsafeLowerBound;

        case WarningType.UnsafeUpperBound:
          return ScoreUnsafeUpperBound;

        case WarningType.UnreachedCodeAfterPrecondition:
          return ScoreUnreachedCodeAfterPrecondition;

        case WarningType.FalseEnsures:
          return ScoreFalseEnsures;

        case WarningType.FalseRequires:
          return ScoreFalseRequires;

        case WarningType.TestAlwaysEvaluatingToAConstant:
          return ScoreTestAlwaysEvaluatingToAConstant;

        default:
          // should be unreachable
#if DEBUG
          Contract.Assume(false);
#endif

          return 1.0;
        #endregion
      }
    }
 public ParameterConditional(WarningType warningType, string description)
 {
     this.warningType = warningType;
     this.description = description;
 }
Ejemplo n.º 9
0
    public WarningArgs(string message, string content, WarningType type) {
      Message = message;
      Content = content;

      Type = type;
    }
Ejemplo n.º 10
0
 /// <summary>
 /// класс предупреждения к кадру
 /// </summary>
 /// <param name="_type">тип предупреждения</param>
 /// <param name="_text">текст предупреждения</param>
 public StepMarkModel(WarningType _type,string _text )
 {
     Type = _type.ToString("G");
     Text = _text;
 }
Ejemplo n.º 11
0
 public Warning(WarningType warning, string description, SmartElement element)
 {
     this.warning = warning;
     this.description = description;
     this.element = element;
 }
Ejemplo n.º 12
0
 public void Mensaje(string vMensaje, WarningType type)
 {
     ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "text", "infatlan.showNotification('top','center','" + vMensaje + "','" + type.ToString().ToLower() + "')", true);
 }
        public async Task <Override> UpdateAsync(Guid id, string country, string area, DateTime searchedOn, DateTime startOn, DateTime endsOn, WarningType warningType)
        {
            var current = await _repository.GetAsync(id).ConfigureAwait(false);

            if (current == null)
            {
                throw new Exception("Item not found");
            }

            var updated = new Override
            {
                Area     = area,
                Country  = country,
                StartsOn = startOn,
                EndsOn   = endsOn,
            };

            try
            {
                var item = await _repository.UpdateAsync(id, updated).ConfigureAwait(false);

                return(item);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
        public async Task <Override> AddAsync(string country, string area, DateTime searchedOn, DateTime startOn, DateTime endsOn, WarningType warningType)
        {
            var warning = new Override
            {
                Area     = area,
                Country  = country,
                StartsOn = startOn,
                EndsOn   = endsOn,
            };

            var item = await _repository.AddAsync(warning).ConfigureAwait(false);

            return(item);
        }
Ejemplo n.º 15
0
 public WarningArgs(WarningType warningType)
 {
     Warning = warningType;
 }