{"id":13629189,"url":"https://github.com/ChristophHornung/EmbeddedResourceGenerator","last_synced_at":"2025-04-17T04:33:09.702Z","repository":{"id":65403109,"uuid":"591616258","full_name":"ChristophHornung/EmbeddedResourceGenerator","owner":"ChristophHornung","description":"A C# source generator to automatically generate access methods for embedded resources.","archived":false,"fork":false,"pushed_at":"2024-11-16T10:13:36.000Z","size":112,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T02:50:32.012Z","etag":null,"topics":["csharp","csharp-sourcegenerator"],"latest_commit_sha":null,"homepage":"","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/ChristophHornung.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":"2023-01-21T09:45:56.000Z","updated_at":"2025-04-01T20:32:30.000Z","dependencies_parsed_at":"2024-05-04T23:32:01.421Z","dependency_job_id":"595962ab-ae04-45a9-8a83-4a0586f2d5e1","html_url":"https://github.com/ChristophHornung/EmbeddedResourceGenerator","commit_stats":{"total_commits":34,"total_committers":3,"mean_commits":"11.333333333333334","dds":"0.32352941176470584","last_synced_commit":"da7f6141042f0699c08de99f3f23fc5b8e8bf01c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristophHornung%2FEmbeddedResourceGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristophHornung%2FEmbeddedResourceGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristophHornung%2FEmbeddedResourceGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristophHornung%2FEmbeddedResourceGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChristophHornung","download_url":"https://codeload.github.com/ChristophHornung/EmbeddedResourceGenerator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249316056,"owners_count":21249885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["csharp","csharp-sourcegenerator"],"created_at":"2024-08-01T22:01:04.151Z","updated_at":"2025-04-17T04:33:09.404Z","avatar_url":"https://github.com/ChristophHornung.png","language":"C#","funding_links":[],"categories":["Content"],"sub_categories":["101. [Chorn.EmbeddedResourceAccessGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Chorn.EmbeddedResourceAccessGenerator) , in the [FilesToCode](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#filestocode) category"],"readme":"# EmbeddedResourceAccessGenerator\n[![NuGet version (Chorn.EmbeddedResourceAccessGenerator)](https://img.shields.io/nuget/v/Chorn.EmbeddedResourceAccessGenerator.svg?style=flat-square)](https://www.nuget.org/packages/Chorn.EmbeddedResourceAccessGenerator/)\n\n\nThe EmbeddedResourceAccessGenerator is a code generator to allow easy access to all\nembedded resources.\n\n## Usage\nGet the nuget package [here](https://www.nuget.org/packages/Chorn.EmbeddedResourceAccessGenerator).\n\nAfter referencing the `Chorn.EmbeddedResourceAccessGenerator` nuget the code generation will\nautomatically create a class `EmbeddedResources` in the root namespace of the project.\n\nTogether with the generated `EmbeddedResource` enumeration there are several options to access\nembedded resources:\n\nE.g. for a `Test.txt` embedded resource in the `TestAsset` folder:\n\n- Via enum access through the `EmbeddedResource` enum:\n\n```csharp\n\t// Via the generated extension methods on the enum\n\tusing Stream s = EmbeddedResource.TestAsset_Test_txt.GetStream();\n\tusing StreamReader sr = EmbeddedResource.TestAsset_Test_txt.GetReader();\n```\n\n- Via enum access through the `EmbeddedResource[FolderName]` enum:\n\n```csharp\n\t// Via the generated extension methods on the enum\n\tusing Stream s = EmbeddedResourceTestAsset.Test_txt.GetStream();\n\tusing StreamReader sr = EmbeddedResourceTestAsset.Test_txt.GetReader();\n```\n\n- Via direct static acccess on `EmbeddedResources`:\n\n```csharp\n\tusing StreamReader sr = EmbeddedResources.TestAsset_Test_txt_Reader;\n\tConsole.WriteLine(sr.ReadToEnd());\n\n\t// Or via access through the Stream\n\tusing Stream s = EmbeddedResources.TestAsset_Test_txt_Stream;\n\t// ...\n```\n\n## Motivation\nInstead of using magic strings in the resource access code that may point to non-existant\nresources this generator guarantees resources to exist and code to not compile when they are\nremoved.\n\nGrouping the resources via their path adds path specific enums, e.g. to easily write tests\nfor all embedded resource in a subfolder.\n\nAlso it saves quite a bit of typing effort.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChristophHornung%2FEmbeddedResourceGenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FChristophHornung%2FEmbeddedResourceGenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChristophHornung%2FEmbeddedResourceGenerator/lists"}