コード例 #1
0
        /// <summary>
        ///  default constructor
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            // set default year
            _year = DateTime.Now.Year;

            // create game class
            _game = new Game(_points);

            // set event hanlders
            _game.Message += OnMessage;
            _game.Budget += OnBudget;

            // create check class
            _check = new Check();

            // set events
            _check.Attack += OnAttack;
            _check.Assault += OnAssault;
            _check.EconomyCrises += OnEconomyCrises;

            // change points
            OnChangePoints();
        }
コード例 #2
0
ファイル: MonitorRun.cs プロジェクト: richard-green/EasyNetQ
 private static CheckResult RunCheckInExceptionHandler(ICheck check, IManagementClient managementClient)
 {
     try
     {
         return check.RunCheck(managementClient);
     }
     catch (UnexpectedHttpStatusCodeException exception)
     {
         return new CheckResult(true, string.Format("Check '{0}' got unexpected status code {1} {2}",
             check.GetType().ToString(),
             exception.StatusCodeNumber,
             exception.StatusCode
             ));
     }
     catch (Exception exception)
     {
         return new CheckResult(true, exception.ToString());
     }
 }
コード例 #3
0
ファイル: CheckFilePresence.cs プロジェクト: shadiwolf/e
 public IssueTemplateDoesNotExist(ICheck check)
     : base(check, IssueType.Problem, "The {0} file \"{1}\" does not exist.")
 {
 }
コード例 #4
0
        public static ICheckLink <ICheck <sbyte> > IsNegative(this ICheck <sbyte> check)
        {
            var numberCheckStrategy = new NumberCheck <sbyte>(check);

            return(numberCheckStrategy.IsStrictlyNegative());
        }
コード例 #5
0
ファイル: UnitAI.cs プロジェクト: wuxinwenxin/CypherCore
        /// <summary>
        /// Select the best (up to) <num> targets (in <targetType> order) satisfying <predicate> from the threat list and stores them in <targetList> (which is cleared first).
        /// If <offset> is nonzero, the first <offset> entries in <targetType> order (or MAXTHREAT order, if <targetType> is RANDOM) are skipped.
        /// </summary>
        public List <Unit> SelectTargetList(uint num, SelectAggroTarget targetType, uint offset, ICheck <Unit> selector)
        {
            var targetList = new List <Unit>();

            ThreatManager mgr = GetThreatManager();

            // shortcut: we're gonna ignore the first <offset> elements, and there's at most <offset> elements, so we ignore them all - nothing to do here
            if (mgr.GetThreatListSize() <= offset)
            {
                return(targetList);
            }

            if (targetType == SelectAggroTarget.MaxDistance || targetType == SelectAggroTarget.MinDistance)
            {
                foreach (HostileReference refe in mgr.GetThreatList())
                {
                    if (!refe.IsOnline())
                    {
                        continue;
                    }

                    targetList.Add(refe.GetTarget());
                }
            }
            else
            {
                Unit currentVictim = mgr.GetCurrentVictim();
                if (currentVictim != null)
                {
                    targetList.Add(currentVictim);
                }

                foreach (HostileReference refe in mgr.GetThreatList())
                {
                    if (!refe.IsOnline())
                    {
                        continue;
                    }

                    Unit thisTarget = refe.GetTarget();
                    if (thisTarget != currentVictim)
                    {
                        targetList.Add(thisTarget);
                    }
                }
            }

            // shortcut: the list isn't gonna get any larger
            if (targetList.Count <= offset)
            {
                targetList.Clear();
                return(targetList);
            }

            // right now, list is unsorted for DISTANCE types - re-sort by MAXDISTANCE
            if (targetType == SelectAggroTarget.MaxDistance || targetType == SelectAggroTarget.MinDistance)
            {
                SortByDistance(targetList, targetType == SelectAggroTarget.MinDistance);
            }

            // now the list is MAX sorted, reverse for MIN types
            if (targetType == SelectAggroTarget.MinThreat)
            {
                targetList.Reverse();
            }

            // ignore the first <offset> elements
            while (offset != 0)
            {
                targetList.RemoveAt(0);
                --offset;
            }

            // then finally filter by predicate
            targetList.RemoveAll(unit => !selector.Invoke(unit));

            if (targetList.Count <= num)
            {
                return(targetList);
            }

            if (targetType == SelectAggroTarget.Random)
            {
                targetList = targetList.SelectRandom(num).ToList();
            }
            else
            {
                targetList.Resize(num);
            }

            return(targetList);
        }
コード例 #6
0
 /// <summary>
 /// Checks that the actual value is positive or equal to zero.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not positive or equal to zero.</exception>
 public static ICheckLink <ICheck <decimal> > IsPositiveOrZero(this ICheck <decimal> check)
 {
     return(new NumberCheck <decimal>(check).IsPositiveOrZero());
 }
コード例 #7
0
 /// <summary>
 /// Checks that the actual value is strictly negative.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not strictly negative.</exception>
 public static ICheckLink <ICheck <float> > IsStrictlyNegative(this ICheck <float> check)
 {
     return(new NumberCheck <float>(check).IsStrictlyNegative());
 }
コード例 #8
0
ファイル: UintCheckExtensions.cs プロジェクト: yhan/NFluent
 /// <summary>
 /// Checks that the actual value is NOT equal to zero.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 ///   <returns>A check link.</returns>
 /// </returns>
 /// <exception cref="FluentCheckException">The value is equal to zero.</exception>
 public static ICheckLink <ICheck <uint> > IsNotZero(this ICheck <uint> check)
 {
     return(check.Not.IsZero());
 }
コード例 #9
0
 protected override void DoSetUp()
 {
     maxChannelsCheck = new MaxChannelsCheck(100);
 }
コード例 #10
0
 public IssueTemplateTooHighBitrate(ICheck check)
     : base(check, IssueType.Problem, "The audio bitrate ({0} kbps) exceeds {1} kbps.")
 {
 }
コード例 #11
0
 protected override void DoSetUp()
 {
     easyNetQErrorQueueCheck = new EasyNetQErrorQueueCheck();
 }
コード例 #12
0
 /// <summary>
 /// Checks that the checker value is equal to another expected value.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <param name="expected">The expected value.</param>
 /// <returns>
 ///  A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The checker value is not equal to the expected value.</exception>
 public static ICheckLink <ICheck <string> > IsEqualTo(this ICheck <string> check, object expected)
 {
     return(IsEqualTo(check, (string)expected));
 }
コード例 #13
0
 /// <summary>
 ///     Checks that the checker value is not equal to another expected value.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <param name="expected">The expected value.</param>
 /// <returns>
 ///     A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The checker value is equal to the expected value.</exception>
 public static ICheckLink <ICheck <string> > IsNotEqualTo(this ICheck <string> check, string expected)
 {
     return(check.Not.IsEqualTo(expected));
 }
コード例 #14
0
 /// <summary>
 ///     Checks that the string has content.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 ///     A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The string is empty or null.</exception>
 public static ICheckLink <ICheck <string> > HasContent(this ICheck <string> check)
 {
     return(IsNotEmpty(check));
 }
コード例 #15
0
 /// <summary>
 ///     Checks that the string does not contain any of the given expected values.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <param name="values">The values not to be present.</param>
 /// <returns>
 ///     A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The string contains at least one of the given strings.</exception>
 public static ICheckLink <ICheck <string> > DoesNotContain(this ICheck <string> check, params string[] values)
 {
     return(check.Not.Contains(values));
 }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NumberCheck{TN}" /> class.
 /// </summary>
 /// <param name="check">The fluent check.</param>
 public NumberCheck(ICheck <TN> check)
 {
     this.check = check;
     // ReSharper disable once SuspiciousTypeConversion.Global
     new Checker <TN, ICheck <TN> >((ICheckForExtensibility <TN, ICheck <TN> >)check);
 }
コード例 #17
0
 public IssueTemplateTooLowBitrate(ICheck check)
     : base(check, IssueType.Problem, "The audio bitrate ({0} kbps) is lower than {1} kbps.")
 {
 }
コード例 #18
0
 public IssueTemplateNoBitrate(ICheck check)
     : base(check, IssueType.Error, "The audio bitrate could not be retrieved.")
 {
 }
コード例 #19
0
ファイル: UintCheckExtensions.cs プロジェクト: yhan/NFluent
 /// <summary>
 /// Checks that the actual value is equal to zero.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not equal to zero.</exception>
 public static ICheckLink <ICheck <uint> > IsZero(this ICheck <uint> check)
 {
     return(new NumberCheck <uint>(check).IsZero());
 }
コード例 #20
0
 /// <summary>
 /// Checks that the actual nullable value has no value and thus, is null.
 /// Note: this method does not return A check link since the nullable is null.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <exception cref="FluentCheckException">The value is not null.</exception>
 public static void HasNoValue(this ICheck <decimal?> check)
 {
     check.Not.HasAValue();
 }
コード例 #21
0
 /// <summary>
 /// Checks that the actual value is positive or equal to zero.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not positive or equal to zero.</exception>
 public static ICheckLink <ICheck <float> > IsPositiveOrZero(this ICheck <float> check)
 {
     return(new NumberCheck <float>(check).IsPositiveOrZero());
 }
コード例 #22
0
 /// <summary>
 /// Checks that the actual value is NOT equal to zero.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 ///   <returns>A check link.</returns>
 /// </returns>
 /// <exception cref="FluentCheckException">The value is equal to zero.</exception>
 public static ICheckLink <ICheck <decimal> > IsNotZero(this ICheck <decimal> check)
 {
     return(check.Not.IsZero());
 }
コード例 #23
0
 public static void IsNotEmpty <T>(this ICheck <IEnumerable <T> > check)
 {
     check.Not.IsEmpty();
 }
コード例 #24
0
 public static ICheckLink <ICheck <decimal> > IsGreaterThan(this ICheck <decimal> check, decimal comparand)
 {
     return(check.Not.IsStrictlyLessThan(comparand));
 }
コード例 #25
0
 /// <summary>
 /// Checks that the actual value is strictly negative.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not strictly negative.</exception>
 public static ICheckLink <ICheck <decimal> > IsStrictlyNegative(this ICheck <decimal> check)
 {
     return(new NumberCheck <decimal>(check).IsStrictlyNegative());
 }
コード例 #26
0
 /// <summary>
 /// Checks that the checked value is strictly greater than the comparand.
 /// </summary>
 /// <param name="check">
 /// The fluent check to be extended.
 /// </param>
 /// <param name="comparand">
 /// Comparand to compare the value to.
 /// </param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">
 /// The checked value is not strictly greater than the comparand.
 /// </exception>
 public static ICheckLink <ICheck <decimal> > IsStrictlyGreaterThan(this ICheck <decimal> check, decimal comparand)
 {
     return(new NumberCheck <decimal>(check).IsStrictlyGreaterThan(comparand));
 }
コード例 #27
0
        /// <summary>
        /// Checks that the actual value is positive or equal to zero.
        /// </summary>
        /// <param name="check">The fluent check to be extended.</param>
        /// <returns>
        /// A check link.
        /// </returns>
        /// <exception cref="FluentCheckException">The value is not positive or equal to zero.</exception>
        public static ICheckLink <ICheck <sbyte> > IsPositiveOrZero(this ICheck <sbyte> check)
        {
            var numberCheckStrategy = new NumberCheck <sbyte>(check);

            return(numberCheckStrategy.IsPositiveOrZero());
        }
コード例 #28
0
 /// <summary>
 /// Checks that the actual value is equal to another expected value.
 /// </summary>
 /// <param name="check">
 /// The fluent check to be extended.
 /// </param>
 /// <param name="expected">
 /// The expected value.
 /// </param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">
 /// The actual value is not equal to the expected value.
 /// </exception>
 public static ICheckLink <ICheck <decimal> > IsEqualTo(this ICheck <decimal> check, decimal expected)
 {
     return(EqualityHelper.PerformEqualCheck(check, expected));
 }
コード例 #29
0
ファイル: CheckFilePresence.cs プロジェクト: shadiwolf/e
 public IssueTemplateNoneSet(ICheck check)
     : base(check, IssueType.Problem, "No {0} has been set.")
 {
 }
コード例 #30
0
ファイル: UintCheckExtensions.cs プロジェクト: yhan/NFluent
 public static ICheckLink <ICheck <uint> > IsGreaterThan(this ICheck <uint> check, uint comparand)
 {
     return(check.Not.IsStrictlyLessThan(comparand));
 }
コード例 #31
0
 /// <summary>
 ///     Checks that the enumerable has the proper number of elements.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <param name="expectedCount">The expected count to be found.</param>
 /// <returns>
 ///     A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The enumerable has not the expected number of elements.</exception>
 public static ICheckLink <ICheck <IEnumerable> > CountIs(this ICheck <IEnumerable> check, long expectedCount)
 {
     return(HasSize(check, expectedCount));
 }
コード例 #32
0
ファイル: UintCheckExtensions.cs プロジェクト: yhan/NFluent
 /// <summary>
 /// Checks that the checked value is strictly greater than the comparand.
 /// </summary>
 /// <param name="check">
 /// The fluent check to be extended.
 /// </param>
 /// <param name="comparand">
 /// Comparand to compare the value to.
 /// </param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">
 /// The checked value is not strictly greater than the comparand.
 /// </exception>
 public static ICheckLink <ICheck <uint> > IsStrictlyGreaterThan(this ICheck <uint> check, uint comparand)
 {
     return(new NumberCheck <uint>(check).IsStrictlyGreaterThan(comparand));
 }
コード例 #33
0
        protected override void DoSetUp()
        {
            var log = MockRepository.GenerateStub<ILog>();

            maxConnectionsCheck = new MaxConnectionsCheck(100, log);
        }
コード例 #34
0
ファイル: UintCheckExtensions.cs プロジェクト: yhan/NFluent
 /// <summary>
 /// Checks that the actual value is equal to another expected value.
 /// </summary>
 /// <param name="check">
 /// The fluent check to be extended.
 /// </param>
 /// <param name="expected">
 /// The expected value.
 /// </param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">
 /// The actual value is not equal to the expected value.
 /// </exception>
 public static ICheckLink <ICheck <uint> > IsEqualTo(this ICheck <uint> check, uint expected)
 {
     return(EqualityHelper.PerformEqualCheck(check, expected));
 }
コード例 #35
0
 protected override void DoSetUp()
 {
     maxQueuedMessagesCheck = new MaxQueuedMessagesCheck(100);
 }
コード例 #36
0
 protected override void DoSetUp()
 {
     easyNetQErrorQueueCheck = new EasyNetQErrorQueueCheck();
 }