{"id":23379659,"url":"https://github.com/kazenetu/csharpanalyze","last_synced_at":"2026-04-11T21:39:15.727Z","repository":{"id":69921473,"uuid":"160521331","full_name":"kazenetu/CSharpAnalyze","owner":"kazenetu","description":"C#のコード解析：ConvertCStoTSの再設計版","archived":false,"fork":false,"pushed_at":"2019-10-30T11:14:08.000Z","size":866,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-23T21:54:03.946Z","etag":null,"topics":["codeanalysis","csharp","dotnet-core"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kazenetu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-05T13:19:59.000Z","updated_at":"2019-10-30T11:12:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"175c6a34-077e-40d1-bf5d-e51d085aba03","html_url":"https://github.com/kazenetu/CSharpAnalyze","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/kazenetu/CSharpAnalyze","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazenetu%2FCSharpAnalyze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazenetu%2FCSharpAnalyze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazenetu%2FCSharpAnalyze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazenetu%2FCSharpAnalyze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kazenetu","download_url":"https://codeload.github.com/kazenetu/CSharpAnalyze/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazenetu%2FCSharpAnalyze/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31696743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T21:17:31.016Z","status":"ssl_error","status_checked_at":"2026-04-11T21:17:24.556Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeanalysis","csharp","dotnet-core"],"created_at":"2024-12-21T19:19:54.519Z","updated_at":"2026-04-11T21:39:15.709Z","avatar_url":"https://github.com/kazenetu.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSharpAnalyze\nC#のコード解析ライブラリ\n\n# 実行環境\n* .NET Core SDK 2.1以上\n\n# 本ライブラリの利用例\n* 他プログラム言語に変換  \n   [C#からTypeScriptへの変換ツール(CStoTS)](https://github.com/kazenetu/CStoTS)\n* ドキュメント作成\n* C#のソース解析の足掛かり\n\n# 前提\n* submoduleなどで他のリポジトリから参照する。\n\n# 実装方法\n下記手順で実装する。\n1. AnalyzeApplicationのインスタンス作成\n1. 解析完了イベントの登録\n1. 解析開始\n\n## 実装例\n```csharp\ntry\n{\n  // 1. AnalyzeApplicationのインスタンス作成\n  var csAnalyze = new AnalyzeApplication();\n\n  // 2. 解析完了イベントの登録(C#ソースファイル単位で発行)\n  csAnalyze.Register\u003cIAnalyzed\u003e(csAnalyze, (ev) =\u003e\n  {\n      // C#ソースファイル名\n      Console.WriteLine($\"[{ev.FilePath}]\");\n\n      // C#ソースコードのコンソール出力\n      Console.WriteLine(ev.FileRoot?.ToString());\n  });\n\n  var srcPath = \"解析対象のフォルダ(相対パス可)\";\n\n  // 3. 解析開始\n  csAnalyze.Analyze(srcPath);\n}\ncatch (Exception ex)\n{\n  // 例外エラー発生時\n  Console.WriteLine(ex.Message);\n  return;\n}\n```\n\n### FileRoot(IFileRoot)の詳細\n```csharp\n  /// \u003csummary\u003e\n  /// ファイルルート インターフェース\n  /// \u003c/summary\u003e\n  public interface IFileRoot\n  {\n    /// \u003csummary\u003e\n    /// ファイルパス\n    /// \u003c/summary\u003e\n    string FilePath { get; }\n\n    /// \u003csummary\u003e\n    /// 外部参照のクラス名とファイルパスのリスト\n    /// \u003c/summary\u003e\n    Dictionary\u003cstring, string\u003e OtherFiles { get; }\n\n    /// \u003csummary\u003e\n    /// 子メンバ\n    /// \u003c/summary\u003e\n    List\u003cIAnalyzeItem\u003e Members { get; }\n  }\n```\n※Membersの具体的なInterfaceは```IAnalyzeItem```を継承した```AnalyzeItems/IItemXxxxx```となる。  \n　詳細は下記参照\n\n### C#とInterfaceの対応表\n```CSharpAnalyze.Domain.PublicInterfaces.AnalyzeItems```で定義  \n\n|C#                   | 対応Interface                  | Membersに複数IAnalyzeItemあり |\n|:--------------------|:-------------------------------|:----------------:|\n|interface            | IItemInterface                 |        ○         |\n|class                | IItemClass                     |        ○         |\n|コンストラクタメソッド | IItemConstructor               |        ○         |\n|フィールド            | IItemField                     |        ×         |\n|プロパティ            | IItemProperty                  |        ○         |\n|メソッド              | IItemMethod                    |        ○         |\n|enum                 | IItemEnum                      |        ×         |\n|foreach              | IItemForEach                   |        ○         |\n|for                  | IItemFor                       |        ○         |\n|while                | IItemWhile                     |        ○         |\n|do-while             | IItemDo                        |        ○         |\n|if                   | IItemIf                        |        ○         |\n|else/else if         | IItemElseClause                |        ○         |\n|switch               | IItemSwitch                    |        ○         |\n|case                 | IItemSwitchCase                |        ○         |\n|break                | IItemBreak                     |        ×         |\n|continue             | ItemContinue                   |        ×         |\n|return               | IItemReturn                    |        ×         |\n|ローカルフィールド生成 | IItemStatementLocalDeclaration |        ×         |\n|ローカルメソッド       | IItemLocalFunction             |        ○         |\n|式                   | IItemStatementExpression       |        ×         |\n\n# テスト方法\n* VisualStudio(2017以上)を利用する場合  \n  ```CSharpAnalyze.sln```を開いてテストを行う\n\n* dotnetコマンドを利用する場合\n  ```sh\n  #CSharpAnalyzeTest/CSharpAnalyzeTest.csprojのテストを実施\n  dotnet test ./CSharpAnalyzeTest/CSharpAnalyzeTest.csproj\n  ```\n\n# ライセンス\n[MIT ライセンス](LICENSE)\n\n# 使用パッケージ\n* [Microsoft.CodeAnalysis.CSharp](https://www.nuget.org/packages/Microsoft.CodeAnalysis.CSharp/) ([Apache-2.0](https://github.com/dotnet/roslyn/blob/master/License.txt))\n* [Microsoft.NetCore.Analyzers](https://www.nuget.org/packages/Microsoft.NetCore.Analyzers/) ([Apache-2.0](https://github.com/dotnet/roslyn-analyzers/blob/master/License.txt))\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkazenetu%2Fcsharpanalyze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkazenetu%2Fcsharpanalyze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkazenetu%2Fcsharpanalyze/lists"}