/// <summary> /// Generates the syntax for a property member. /// </summary> public static MemberDeclarationSyntax GeneratePropertySyntax(LocalisationMember member) => SyntaxFactory.ParseMemberDeclaration( string.Format(SyntaxTemplates.PROPERTY_MEMBER_TEMPLATE, member.Name, member.Key, convertToVerbatim(member.EnglishText), member.EnglishText)) !;
/// <summary> /// Generates the syntax for accessing the member. /// </summary> public static MemberAccessExpressionSyntax GenerateMemberAccessSyntax(LocalisationFile localisationFile, LocalisationMember member) => SyntaxFactory.MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, SyntaxFactory.IdentifierName(localisationFile.Name), SyntaxFactory.IdentifierName(member.Name));
/// <summary> /// Generates the syntax for a method member. /// </summary> public static MemberDeclarationSyntax GenerateMethodSyntax(Workspace workspace, LocalisationMember member) { var paramList = SyntaxFactory.ParameterList( SyntaxFactory.SeparatedList( member.Parameters.Select(param => SyntaxFactory.Parameter( SyntaxFactory.Identifier(param.Name)) .WithType( SyntaxFactory.IdentifierName(param.Type))))); var argList = SyntaxFactory.ArgumentList( SyntaxFactory.SeparatedList( member.Parameters.Select(param => SyntaxFactory.Argument( SyntaxFactory.IdentifierName(param.Name))))); return(SyntaxFactory.ParseMemberDeclaration( string.Format(SyntaxTemplates.METHOD_MEMBER_TEMPLATE, member.Name, Formatter.Format(paramList, workspace).ToFullString(), member.Key, convertToVerbatim(member.EnglishText), Formatter.Format(argList, workspace).ToFullString()[1..^ 1], // The entire string minus the parens member.EnglishText)) !); // Todo: Improve xmldoc }