Skip to content

ssaattww/TextConverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TextConverter

テキスト入力を C# パーサーで解析し、Razor テンプレートで出力を生成するデスクトップアプリです。

スクリーンショット

起動時の画面

できること

  • 入力テキストを C# (Sprache) でパースし、任意のモデルに変換
  • Razor テンプレートで出力を整形
  • 自動実行 / 手動実行の切替、ワーカープロセス再起動によるメモリー開放
  • 入力 / パーサー / テンプレートを外部ファイルから読み込み

入力 (samples/input.txt):

foo: 1
bar: 2

パーサー (samples/parser.cs の一部イメージ):

public class ModelClass
{
    public string Key { get; set; }
    public string Value { get; set; }
}
// 入力を List<ModelClass> に変換

テンプレート (samples/template.cshtml の一部イメージ):

@using System.Collections.Generic
@model IEnumerable<ModelClass>

@foreach (var it in Model)
{
@: - @it.Key: @it.Value
}

出力:

- foo: 1
- bar: 2

ビルド環境

  • .NET SDK 8.0 以上
  • Windows x64 を想定(Avalonia Desktop)

ビルド方法

dotnet build

実行:

dotnet run --project src/TextConverter.csproj

任意: 配布用ビルド

dotnet publish -c Release -r win-x64 --project src/TextConverter.csproj

設定ファイル

samples/TextConverter.config.json で読み込むファイルを指定できます。

例:

{
  "inputPath": "input.txt",
  "parserPath": "parser.cs",
  "templatePath": "template.cshtml"
}

パスは 設定ファイルの場所からの相対パスとして解決されます。

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages