Ejemplo n.º 1
0
        private Result RewriteUnaryExpression(Expression expr, Stack stack)
        {
            var node = (UnaryExpression)expr;

            Debug.Assert(node.NodeType != ExpressionType.Quote, "unexpected Quote");
            Debug.Assert(node.NodeType != ExpressionType.Throw, "unexpected Throw");

            // Operand is emitted on top of the stack as-is.
            Result?result = null;

            if (node.Operand != null)
            {
                result = RewriteExpression(node.Operand, stack);
            }

            if (result == null)
            {
                return(new Result(RewriteAction.None, expr));
            }

            var expression = result.Value;

            if (expression.Action == RewriteAction.SpillStack)
            {
                RequireNoRefArgs(node.Method);
            }

            if (expression.Action != RewriteAction.None)
            {
                expr = new UnaryExpression(node.NodeType, expression.Node, node.Type, node.Method);
            }

            return(new Result(expression.Action, expr));
        }
Ejemplo n.º 2
0
        private Result RewriteLabelExpression(Expression expr, Stack stack)
        {
            var node = (LabelExpression)expr;

            Result?result = null;

            if (node.DefaultValue != null)
            {
                result = RewriteExpression(node.DefaultValue, stack);
            }

            if (result == null)
            {
                return(new Result(RewriteAction.None, expr));
            }

            var expression = result.Value;

            if (expression.Action != RewriteAction.None)
            {
                expr = new LabelExpression(node.Target, expression.Node);
            }

            return(new Result(expression.Action, expr));
        }
Ejemplo n.º 3
0
        public void Deal()
        {
            deck.NewDeck();
            deck.Shuffle();

            playerHand.AddCard(deck.TakeCard());
            dealerHand.AddCard(deck.TakeCard());
            playerHand.AddCard(deck.TakeCard());
            dealerHand.AddCard(deck.TakeCard());

            dealerHand.CheckFor21();
            playerHand.CheckFor21();
            if (playerHand.BlackJack)
            {
                GameResult = Result.BlackJack;
                return;
            }

            playerHand.CheckHandValue();
            io.DisplayMessage($"Your cards are: {playerHand.ShowHand()}");
            io.DisplayMessage($"Your total is {playerHand.Total}");

            if (dealerHand.BlackJack)
            {
                io.DisplayMessage($"Dealer has BlackJack!");
                GameResult = Result.DealerWin;
                return;
            }
            else
            {
                io.DisplayMessage($"The dealer has a {dealerHand.Cards[0].CardNumber}");
            }
        }
Ejemplo n.º 4
0
        public static Result <TEntity> From([AllowNull] Result?other)
        {
            if (other == null)
            {
                return(new Result <TEntity>(false, ReasonCode.UnknownError, "An error occurred.", "Other result was null."));
            }

            var otherContent = default(TEntity) !;
            var typeOfOther  = other.GetType();

            if (other.Succeeded)
            {
                if (typeOfOther.IsGenericType && (typeOfOther.GenericTypeArguments[0].IsSubclassOf(typeof(TEntity)) ||
                                                  typeOfOther.GenericTypeArguments[0] == typeof(TEntity)))
                {
                    var property = typeOfOther.GetProperty(nameof(Entity));
                    otherContent = (TEntity)property?.GetValue(other) !;
                }
                else
                {
                    throw new ArgumentException($"Type of '{nameof(other)}.{nameof(Entity)}' is not assignable to '{typeof(TEntity)}'.");
                }
            }

            return(new Result <TEntity>(other.Succeeded, other.ReasonCode, other.ErrorMessage, other.DetailErrorMessage, otherContent));
        }
Ejemplo n.º 5
0
        void TestPackage(int i, List <List <Instance> > packages, int[,] Confusion)
        {
            //create lists for learn and test data
            List <Instance> ToTest  = packages[i];
            List <Instance> ToLearn = new List <Instance>();

            //merge learning data into one list
            for (int j = 0; j < packages.Count; j++)
            {
                if (j == i)
                {
                    continue;
                }
                ToLearn = ToLearn.Concat <Instance>(packages[j]).ToList <Instance>();
            }

            //bayes algorithm to test with learning data
            Bayes b = new Bayes(ToLearn);

            //classify each instance from test package and add to confusion matrix
            foreach (Instance instance in ToTest)
            {
                Result?res = b.Classify(instance);
                Confusion[(int)instance.Result, (int)res]++;
            }
        }
Ejemplo n.º 6
0
        public void Hit()
        {
            while (!playerHand.Stand && !playerHand.Busted)
            {
                io.DisplayMessage($"Do you want another card?");
                io.DisplayMessage($"Hit = H");
                io.DisplayMessage($"Stand = S");
                string input = io.GetInput();
                if (input == "H" || input == "h")
                {
                    string message = playerHand.DealCard(deck);
                    io.DisplayMessage($"You have drawn a {message}");
                    playerHand.CheckHandValue();
                    playerHand.CheckFor21();
                    io.DisplayMessage($"Your cards are:  ={playerHand.ShowHand()}");
                    io.DisplayMessage($"Your total is {playerHand.Total}");
                }
                else if (input == "S" || input == "s")
                {
                    playerHand.Stand = true;
                }
                else
                {
                    io.DisplayMessage($"{input} is not a valid choice");
                }
            }

            if (playerHand.Busted)
            {
                io.DisplayMessage($"It's a bust");
                GameResult = Result.DealerWin;
                return;
            }
            return;
        }
Ejemplo n.º 7
0
        public static Result Get(int startAt)
        {
            if (startAt < 0)
            {
                throw new ArgumentException("Start at should not smaller than zero.");
            }
            startAt += 1;
            Result?result = null;
            var    frames = new StackTrace().GetFrames();

            for (int i = startAt; i < frames.Length; i++)
            {
                var current = At(i);
                if (current.TypeName.StartsWith("<>c"))
                {
                    continue;
                }
                else
                {
                    result = current;
                    break;
                }
            }
            return(result ?? Default);

            Result At(int index)
            {
                return(new Result(
                           frames[index]?.GetMethod()?.DeclaringType?.Name ?? String.Empty,
                           frames[index]?.GetMethod()?.Name ?? String.Empty
                           ));
            }
        }
        //
        // GET: /Manage/ManageLogins
        public async Task <ActionResult> ManageLogins(Result?result)
        {
            ViewBag.StatusMessage = Options.GetMessage(result ?? default(Result));

            var userId = UserId;

            var user = await UserManager.FindByIdAsync(userId);

            if (user == null)
            {
                return(View("Error"));
            }

            var userLogins = await UserManager.GetLoginsAsync(userId);

            var otherLogins = AuthManager.GetExternalAuthenticationTypes()
                              .Where(auth => userLogins.All(ul => auth.AuthenticationType != ul.LoginProvider)).ToList();

            ViewBag.ShowRemoveButton = user.PasswordHash != null || userLogins.Count > 1;

            return(View(new ManageLoginsViewModel
            {
                CurrentLogins = userLogins,
                OtherLogins = otherLogins
            }));
        }
Ejemplo n.º 9
0
        private void ApplyOutcome(Result result)
        {
            if (_result.HasValue)
            {
                throw new InvalidOperationException("TestResultShim status should only be set once.");
            }

            _result = result;
        }
Ejemplo n.º 10
0
 public void LogResult(Result result)
 {
     if (LoggingState == LoggingState.HasVariation)
     {
         Loggers.LogResult(result);
         currentResult = result;
     }
     //else, no-op
 }
Ejemplo n.º 11
0
        private void LogDetail(
            Guid id,
            string type,
            string name,
            State state,
            Result?result            = null,
            DateTimeOffset?startTime = null,
            DateTimeOffset?endTime   = null,
            string order             = null,
            string progress          = null,
            Guid?parentId            = null)
        {
            _builder.Start("logdetail");
            _builder.AddProperty("id", id);

            if (parentId != null)
            {
                _builder.AddProperty("parentid", parentId.Value);
            }

            // Certain values on logdetail can only be set once by design of VSO
            if (_detailedLoggedSet.Add(id))
            {
                _builder.AddProperty("type", type);
                _builder.AddProperty("name", name);

                if (!string.IsNullOrEmpty(order))
                {
                    _builder.AddProperty("order", order);
                }
            }

            if (startTime.HasValue)
            {
                _builder.AddProperty("starttime", startTime.Value);
            }

            if (endTime.HasValue)
            {
                _builder.AddProperty("endtime", endTime.Value);
            }

            if (!string.IsNullOrEmpty(progress))
            {
                _builder.AddProperty("progress", progress);
            }

            _builder.AddProperty("state", state.ToString());
            if (result.HasValue)
            {
                _builder.AddProperty("result", result.Value.ToString());
            }

            _builder.Finish();

            Console.WriteLine(_builder.GetMessage());
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Writes an exception.  This is a fancy overload for WriteError.
        /// </summary>
        /// <param name="exception">Your exception</param>
        /// <param name="format">A description of what was happening when you caught the exception.</param>
        /// <param name="arguments">Any other arguments you have.</param>
        public void WriteException(Result?result, Exception exception, string format, params object[] arguments)
        {
            System.Diagnostics.Debug.Assert(null == result || result == Result.Exception || result == Result.ProductException || result == Result.Timeout);

            // Set the current time
            int numberOfErrorsWritten = 0;

            CurrentTime = DateTime.Now;

            // Format the string if we need to
            if (arguments != null && arguments.Length > 0)
            {
                format = string.Format(CultureInfo.InvariantCulture, format, arguments);
            }

            // Call WriteError for each ILogProvider
            foreach (ILogProvider cur in this.logProviders)
            {
                if (!IsLogProviderActive(cur))
                {
                    continue;
                }

                try
                {
                    cur.WriteException(exception, format);
                    ++numberOfErrorsWritten;
                }
                catch (Exception ex)
                {
                    if (logProviderActivityList.ContainsKey(cur.LogProviderName))
                    {
                        logProviderActivityList[cur.LogProviderName] = false;
                    }

                    Console.WriteLine("Error in WriteError for " + cur.LogProviderName + ":" + ex.Message + System.Environment.NewLine + ex.StackTrace + System.Environment.NewLine);

                    if (ex.InnerException != null)
                    {
                        Console.WriteLine("InnerException " + ex.InnerException.Message + System.Environment.NewLine + ex.InnerException.StackTrace + System.Environment.NewLine);
                    }
                }

                if (0 == numberOfErrorsWritten)
                {
                    Console.WriteLine(format, arguments);

                    if (null != exception)
                    {
                        Console.WriteLine(exception.Message + System.Environment.NewLine + exception.StackTrace + System.Environment.NewLine);
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public bool Equals(Result?other)
        {
            if (other is Success && this is Success)
            {
                return(true);
            }
            if (other is Error a && this is Error b)
            {
                return(a.Equals(b));
            }

            return(false);
        }
Ejemplo n.º 14
0
        private async Task <IResponse> Handle(InsertExternalOrder m)
        {
            this.log.Info($"Incoming request to queue third party order with external id '{m.Id}'");

            string          newHash       = CalculateHash(m);
            Result <string>?existingOrder = await GetExistingOrderByExternalIdentifier(m.Id);

            switch (existingOrder)
            {
            case IsSome <string> hash:
                if (newHash != hash.Value)
                {
                    this.log.Warning($"Retrieved order with external id '{m.Id}' is different then older version! Skipping ...");
                }
                else
                {
                    this.log.Info($"Already processed order with external id '{m.Id}'. Skipping...");
                }

                return(new OrderAlreadyProcessed());

            case IsFailure:
                this.log.Error($"Could not process order with external id '{m.Id}'");
                return(new OrderFailedToReceive());
            }

            if (await this.processorActor.Ask(
                    new ProcessorParentActor.AddToQueue <ExternalOrderProcessor.ExternalOrderQueueItem>
            {
                UniqueKey = m.Id,
                Item = this.mapper.Map <ExternalOrderProcessor.ExternalOrderQueueItem>(m)
            }) is not ProcessorParentActor.Queued)
            {
                return(new OrderFailedToReceive());
            }

            Result?result = await this.relationalDataStoreActorProvider.ExecuteCommand(
                DataStoreStatements.InsertOrderHash,
                new
            {
                ExternalId = m.Id,
                Hash       = newHash,
                Now        = this.clock.Now()
            });

            return(result switch
            {
                IsSuccess => new OrderReceived(),
                _ => new OrderFailedToReceive(),
            });
Ejemplo n.º 15
0
    private string GetGestureType(Result?gestureResult)
    {
        if (gestureResult.HasValue)
        {
            var result = gestureResult.Value;

            if (result.Score > 0.8f)
            {
                Debug.Log(result.GestureClass + " " + result.Score);
                return(result.GestureClass);
            }
        }
        return("");
    }
Ejemplo n.º 16
0
        /// <summary>
        /// Verify the specified number of occurences against expectations.
        /// </summary>
        /// <param name="count">Occurence count.</param>
        /// <param name="timeout">Time to wait if expectations have not yet been met.</param>
        /// <returns>Verification result</returns>
        public Result Verify(int count, TimeSpan timeout)
        {
            while (true)
            {
                Result?result = null;
                switch (_type)
                {
                case Type.Exactly:
                    if (count > _times)
                    {
                        result = Result.TooMany;
                        break;
                    }
                    if (count < _times)
                    {
                        result = Result.TooFew;
                    }
                    break;

                case Type.AtLeast:
                    if (count < _times)
                    {
                        result = Result.TooFew;
                    }
                    break;

                case Type.AtMost:
                    if (count > _times)
                    {
                        result = Result.TooMany;
                    }
                    break;
                }
                if (!result.HasValue)
                {
                    result = Result.Ok;
                }
                if (timeout.TotalMilliseconds <= 0)
                {
                    return(result.Value);
                }
                if (result != Result.TooFew && (count != 0 || result != Result.Ok))
                {
                    return(result.Value);
                }
                Thread.Sleep(Math.Min(100, (int)timeout.TotalMilliseconds));
                timeout = timeout.Subtract(TimeSpan.FromMilliseconds(100));
            }
        }
Ejemplo n.º 17
0
        public Result?FillWithRandomNumbers(int count, int maxValue, int minValue)
        {
            table.Clear();

            for (int i = 0; i != count; i++)
            {
                Result?result = table.Add(new Number(new Random().Next(maxValue, minValue + 1)));

                if (result.HasValue == false)
                {
                    return(result);
                }
            }

            return(Result.OK("Filling of " + count + " random numbers from interval " + minValue + " to " + maxValue + " is successful"));
        }
Ejemplo n.º 18
0
 public void EndVariation(string variationName)
 {
     if (LoggingState == LoggingState.IsConnected) //We're in a semi-bogus state. Synthesize sequence of corrective actions.
     {
         BeginVariation("Missing BeginVariation");
         LogMessage("BUG: No BeginVariation message was recieved");
         LogResult(Result.Fail);
         EndVariation("Missing BeginVariation");
     }
     else if (LoggingState == LoggingState.HasVariation) //Proper scenario
     {
         Loggers.EndVariation(variationName);
         currentVariationName = null;
         currentResult        = null;
         currentTestLogResult = null;
     }
 }
        //
        // GET: /Manage/Index
        public async Task <ActionResult> Index(Result?result)
        {
            ViewBag.StatusMessage = Options.GetMessage(result ?? default(Result));

            var userId = UserId;

            // TODO: TBD: establish auto mappings...
            var model = new IndexViewModel
            {
                HasPassword       = HasPassword(),
                TwoFactor         = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins            = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthManager.TwoFactorBrowserRememberedAsync(userId.ToString("D"))
            };

            return(View(model));
        }
Ejemplo n.º 20
0
        // BinaryExpression: AndAlso, OrElse
        private Result RewriteLogicalBinaryExpression(Expression expr, Stack stack)
        {
            var node = (BinaryExpression)expr;

            // Left expression runs on a stack as left by parent
            var left = RewriteExpression(node.Left, stack);
            // ... and so does the right one
            var right = RewriteExpression(node.Right, stack);
            //conversion is a lambda. stack state will be ignored.

            Result?conversion = null;

            if (node.Conversion != null)
            {
                conversion = RewriteExpression(node.Conversion, stack);
            }

            if (conversion == null)
            {
                return(new Result(RewriteAction.None, expr));
            }

            var action = left.Action | right.Action | conversion.Value.Action;

            if (action != RewriteAction.None)
            {
                // We don't have to worry about byref parameters here, because the
                // factory doesn't allow it (it requires identical parameters and
                // return type from the AndAlso/OrElse method)

                expr = BinaryExpression.Create
                       (
                    node.NodeType,
                    left.Node,
                    right.Node,
                    node.Type,
                    node.Method,
                    (LambdaExpression)conversion.Value.Node
                       );
            }

            return(new Result(action, expr));
        }
Ejemplo n.º 21
0
        public void FindLongestSequence()
        {
            Result?longestSequence = null;
            int    best            = 0;

            for (int i = 2; i <= 1_000; i++)
            {
                if (GetRepeatingSequence(i) is { } result)
                {
                    Console.WriteLine($"Found 1/{i} with sequence L '{result.SequenceLength}' {result.Value}");
                    if (result.SequenceLength > (longestSequence?.SequenceLength ?? 0))
                    {
                        longestSequence = result;
                        best            = i;
                    }
                }
            }
            Console.WriteLine($"Best 1/{best} with length '{longestSequence?.SequenceLength ?? 0}' {longestSequence?.Value}");
        }
Ejemplo n.º 22
0
        public void EndGame()
        {
            if (GameResult == null)
            {
                io.DisplayMessage($"You have {playerHand.Total} and Dealer has {dealerHand.Total}");
                if (playerHand.Total == dealerHand.Total)
                {
                    GameResult = Result.Draw;
                }
                else if (playerHand.Total > dealerHand.Total)
                {
                    GameResult = Result.PlayerWin;
                }
                else
                {
                    GameResult = Result.DealerWin;
                }
            }

            switch (GameResult)
            {
            case Result.BlackJack:
                io.DisplayMessage($"You have Blackjack!");
                player.Payout(Bet, 3);
                break;

            case Result.DealerWin:
                player.Payout();
                break;

            case Result.PlayerWin:
                player.Payout(Bet, 2);
                break;

            case Result.Draw:
                player.Payout(Bet);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 23
0
        public Result Show(string message, Result?optResult = Result.Yes)
        {
            string promptText;

            if (optResult.HasValue)
            {
                promptText = optResult.Value == Result.Yes ? "[y] >" : "[n] >";
            }
            else
            {
                promptText = ">";
            }

            CLIConsole.Write(message, PromptConfig.PromptColor);
            CLIConsole.WriteLine("(y/n)");
            CLIConsole.Write(promptText);
            while (true)
            {
                var rawInput = Console.ReadLine();
                var input    = rawInput.ToLower().Trim();
                if (optResult.HasValue && input == "")
                {
                    var result = optResult.Value;
                    return(result);
                }

                switch (input)
                {
                case "y":
                case "yes":
                    return(Result.Yes);

                case "n":
                case "no":
                    return(Result.No);
                }

                CLIConsole.WriteLine("type 'y' or 'n'");
                CLIConsole.Write(promptText);
            }
        }
Ejemplo n.º 24
0
 public EditDurationEvent With(bool?changedStartDateWithBarrel = null, bool?changedStartTimeWithBarrel = null,
                               bool?changedEndDateWithBarrel   = null, bool?changedEndTimeWithBarrel   = null,
                               bool?changedStartTimeWithWheel  = null, bool?changedEndTimeWithWheel    = null,
                               bool?changedBothTimesWithWheel  = null, bool?changedDurationWithNumPad  = null,
                               bool?stoppedRunningEntry        = null, Result?result = null)
 {
     return(new EditDurationEvent(
                changedStartDateWithBarrel ?? this.changedStartDateWithBarrel,
                changedStartTimeWithBarrel ?? this.changedStartTimeWithBarrel,
                changedEndDateWithBarrel ?? this.changedEndDateWithBarrel,
                changedEndTimeWithBarrel ?? this.changedEndTimeWithBarrel,
                changedStartTimeWithWheel ?? this.changedStartTimeWithWheel,
                changedEndTimeWithWheel ?? this.changedEndTimeWithWheel,
                changedBothTimesWithWheel ?? this.changedBothTimesWithWheel,
                changedDurationWithNumPad ?? this.changedDurationWithNumPad,
                entryWasRunningWhenOpened,
                stoppedRunningEntry ?? this.stoppedRunningEntry,
                navigationOrigin,
                result ?? this.result
                ));
 }
Ejemplo n.º 25
0
 public void DealerHit()
 {
     dealerHand.CheckHandValue();
     dealerHand.CheckDealerStand();
     io.DisplayMessage($"Dealer's cards are:  ={dealerHand.ShowHand()}");
     System.Threading.Thread.Sleep(1000);
     while (!dealerHand.Stand && !dealerHand.Busted)
     {
         string message = dealerHand.DealCard(deck);
         io.DisplayMessage($"Dealer has drawn a {message}");
         dealerHand.CheckHandValue();
         dealerHand.CheckDealerStand();
         io.DisplayMessage($"Dealer's cards are:  ={dealerHand.ShowHand()}");
         io.DisplayMessage($"Dealer's total is {dealerHand.Total}.");
         System.Threading.Thread.Sleep(1000);
     }
     if (dealerHand.Busted)
     {
         GameResult = Result.PlayerWin;
         return;
     }
     return;
 }
Ejemplo n.º 26
0
        private Result RewriteMemberExpression(Expression expr, Stack stack)
        {
            var node = (MemberExpression)expr;

            // Expression is emitted on top of the stack in current state.

            Result?expression = null;

            if (node.Expression != null)
            {
                expression = RewriteExpression(node.Expression !, stack);
            }

            if (expression == null)
            {
                return(new Result(RewriteAction.None, expr));
            }

            switch (expression.Value.Action)
            {
            case RewriteAction.None:
                return(new Result(expression.Value.Action, expr));

            case RewriteAction.SpillStack when node.Member is PropertyInfo:
                // Only need to validate properties because reading a field
                // is always side-effect free.
                RequireNotRefInstance(node.Expression !);
                break;

            default:
                break;
            }

            expr = MemberExpression.Make(expression.Value.Node, node.Member);

            return(new Result(expression.Value.Action, expr));
        }
Ejemplo n.º 27
0
        public void Should_have_correct_result(Result?result)
        {
            var gameData = CreateData();

            var gameResultService = new Mock <IGameResultService>();

            gameResultService
            .Setup(x => x.GetResult(It.IsAny <GameData>()))
            .Returns(result);

            var ruleStrategyFactory = new Mock <IRuleStrategyFactory>();

            ruleStrategyFactory
            .Setup(x => x.Create(It.IsAny <IEnumerable <Rule> >()))
            .Returns(CreateRuleStrategy());

            var subject = new PlayCardHandler(
                gameResultService.Object,
                ruleStrategyFactory.Object);

            var data = subject.Run(CreateStep(gameData));

            data.Result.Should().Be(result);
        }
Ejemplo n.º 28
0
        public override object VisitNamespaceVariableStatement(NamespaceVariableStatementContext context)
        {
            var r1 = ((Result)Visit(context.id()));

            Add_ID(r1.text);
            var    is_mutable = r1.is_virtual;
            var    typ        = "";
            Result?r2         = null;

            if (context.expression() != null)
            {
                r2  = ((Result)Visit(context.expression()));
                typ = ((string)r2.data);
            }
            if (context.typeType() != null)
            {
                typ = ((string)Visit(context.typeType()));
            }
            var isMutable = true;

            if (!r1.isMutable)
            {
                switch (typ)
                {
                case "int":
                { isMutable = false; } break;

                case "uint":
                { isMutable = false; } break;

                case "long":
                { isMutable = false; } break;

                case "ulong":
                { isMutable = false; } break;

                case "ushort":
                { isMutable = false; } break;

                case "short":
                { isMutable = false; } break;

                case "byte":
                { isMutable = false; } break;

                case "sbyte":
                { isMutable = false; } break;

                case "float":
                { isMutable = false; } break;

                case "double":
                { isMutable = false; } break;

                case "bool":
                { isMutable = false; } break;

                case "char":
                { isMutable = false; } break;

                case "string":
                { isMutable = false; } break;
                }
            }
            var obj = "";

            if (context.annotationSupport() != null)
            {
                obj += Visit(context.annotationSupport());
            }
            if (self_property_content.Size() > 0)
            {
                obj += (new System.Text.StringBuilder().Append(r1.permission).Append(" static ").Append(typ).Append(" ").Append(r1.text).Append(BlockLeft)).To_Str();
                foreach (var v in self_property_content)
                {
                    obj += v;
                }
                obj += BlockRight + Wrap;
                self_property_content.Clear();
            }
            else if (isMutable || r2 == null)
            {
                obj += (new System.Text.StringBuilder().Append(r1.permission).Append(" static ").Append(typ).Append(" ").Append(r1.text)).To_Str();
                if (r2 != null)
                {
                    obj += (new System.Text.StringBuilder().Append(" = ").Append(r2.text).Append(Terminate).Append(Wrap)).To_Str();
                }
                else
                {
                    obj += Terminate + Wrap;
                }
            }
            else
            {
                obj += (new System.Text.StringBuilder().Append(r1.permission).Append(" const ").Append(typ).Append(" ").Append(r1.text).Append(" = ").Append(r2.text).Append(Terminate).Append(Wrap)).To_Str();
            }
            return(obj);
        }
Ejemplo n.º 29
0
        private bool CheckAndTransferToResult()
        {
            Debug.Assert(!IsResult, "phase is already result.");

            if (ForceResultInNextTick == Result.Lose || BattleRule.CheckLose(_context))
            {
                ForceResultInNextTick = null;
                Transfer(ResultLost);
                return true;
            }

            if (ForceResultInNextTick == Result.Win || BattleRule.CheckWin(_context))
            {
                ForceResultInNextTick = null;
                Transfer(ResultWon);
                return true;
            }

            return false;
        }
Ejemplo n.º 30
0
 public FmodException(Result ErrorResult, string message, Exception InnerException) : base(message, InnerException)
 {
     Result = ErrorResult;
 }
Ejemplo n.º 31
0
        private void ApplyOutcome(Result result)
        {
            if (_result.HasValue)
                throw new InvalidOperationException("TestResultShim status should only be set once.");

            _result = result;
        }
Ejemplo n.º 32
0
 public FmodException(Result ErrorResult, string message) : base(message)
 {
     Result = ErrorResult;
 }