Esempio n. 1
0
    public static async Task <byte[]> GenerateAsync(DateOnly date, MenuType type, Menu menu)
    {
        using var drawingBoard = new DrawingBoard(AssetPath.MenuTemplateImage);

        drawingBoard
        .AddFont("title", AssetPath.BoldFont, TitleFontSize, FontStyle.Regular)
        .AddFont("subtitle", AssetPath.BoldFont, SubTitleFontSize, FontStyle.Regular)
        .AddFont("content", AssetPath.RegularFont, ContentFontSize, FontStyle.Regular);

        var titleFont    = drawingBoard.Fonts["title"];
        var subTitleFont = drawingBoard.Fonts["subtitle"];
        var contentFont  = drawingBoard.Fonts["content"];

        var titlePosition = new PointF(ContentPosXStart, TitlePosYStart);

        var titleText = new StringBuilder()
                        .AppendLine(date.GetFormattedKoreanString())
                        .Append($"오늘의 청강대 ")
                        .Append(type switch
        {
            MenuType.Breakfast => "아침",
            MenuType.Lunch => "점심",
            MenuType.Dinner => "저녁",
            _ => string.Empty,
        })
Esempio n. 2
0
 private static string MakeTweetText(DateOnly date, MenuType type, Menu menu)
 {
     var builder = new StringBuilder()
                   .AppendLine($"[{date.GetFormattedKoreanString()}]")
                   .Append("🥪 오늘의 청강대 ")
                   .Append(type switch
     {
         MenuType.Breakfast => "아침",
         MenuType.Lunch => "점심",
         MenuType.Dinner => "저녁",
         _ => string.Empty
     })