public static QuestAction EndState(StatementSyntax expression) { if (expression is YieldStatementSyntax) { var expr = expression.As <YieldStatementSyntax>().Expression; if (expr == null) { return(new QuestAction { Type = QuestActionType.EndState, Source = expression.ToString(), }); } } return(null); }
public static QuestAction SkipFrame(StatementSyntax expression) { if (expression is YieldStatementSyntax) { var expr = expression.As <YieldStatementSyntax>().Expression; if (expr != null && expr.Kind() == Microsoft.CodeAnalysis.CSharp.SyntaxKind.NullLiteralExpression) { return(new QuestAction { Type = QuestActionType.SkipFrame, Source = expression.ToString(), }); } } return(null); }
public static QuestAction WaitSomeTime(StatementSyntax expression) { if (expression is YieldStatementSyntax) { var expr = expression.As <YieldStatementSyntax>().Expression.As <LiteralExpressionSyntax>(); if (expr != null && expr.Kind() == Microsoft.CodeAnalysis.CSharp.SyntaxKind.NumericLiteralExpression) { return(new QuestAction { Type = QuestActionType.WaitSomeTime, Source = expression.ToString(), Properties = new Dictionary <string, object> { ["time"] = expr.Token.ValueText }, }); } } return(null); }
public static void WriteStatementAsBlock(OutputWriter writer, StatementSyntax statement, bool writeBraces = true) { if (statement is BlockSyntax) { WriteBlock(writer, statement.As <BlockSyntax>(), writeBraces); } else { if (writeBraces) { writer.OpenBrace(); } Write(writer, statement); TriviaProcessor.ProcessTrivias(writer, statement.DescendantTrivia()); if (writeBraces) { writer.CloseBrace(); } } }
public static void WriteStatementAsBlock(OutputWriter writer, StatementSyntax statement, bool writeBraces = true) { if (statement is BlockSyntax) WriteBlock(writer, statement.As<BlockSyntax>(), writeBraces); else { if (writeBraces) writer.OpenBrace(); Write(writer, statement); TriviaProcessor.ProcessTrivias(writer, statement.DescendantTrivia()); if (writeBraces) writer.CloseBrace(); } }