H.Resources.Generator
1.5.0
See the version list below for details.
dotnet add package H.Resources.Generator --version 1.5.0
NuGet\Install-Package H.Resources.Generator -Version 1.5.0
<PackageReference Include="H.Resources.Generator" Version="1.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
paket add H.Resources.Generator --version 1.5.0
#r "nuget: H.Resources.Generator, 1.5.0"
// Install H.Resources.Generator as a Cake Addin
#addin nuget:?package=H.Resources.Generator&version=1.5.0
// Install H.Resources.Generator as a Cake Tool
#tool nuget:?package=H.Resources.Generator&version=1.5.0
H.Resources.Generator
Nuget
Install-Package H.Resources.Generator
Usage
Just install this package and add any resources to Resources subfolder. After you can use resources in the code:
var bytes = H.Resources.name_png.AsBytes();
// or
var text = H.Resources.name_txt.AsText();
Advanced Usage
<PropertyGroup>
<HResourcesGenerator_WithSystemDrawing>true</HResourcesGenerator_WithSystemDrawing>
</PropertyGroup>
<ItemGroup Label="Images">
<EmbeddedResource Include="Images\*.png" />
<AdditionalFiles Include="Images\*.png" />
</ItemGroup>
After it, use resource in code:
var image = H.Resources.image_name_png.AsImage();
// or
var bytes = H.Resources.image_name_png.AsBytes();
Available methods:
- System.Drawing.Image AsImage() (only if
HResourcesGenerator_WithSystemDrawing
is true) - System.IO.Stream AsStream()
- string AsString()
- byte[] AsBytes()
Global options(Default values are provided and can be omitted):
<PropertyGroup>
<HResourcesGenerator_Namespace>H</HResourcesGenerator_Namespace>
<HResourcesGenerator_Modifier>internal</HResourcesGenerator_Modifier>
<HResourcesGenerator_ClassName>Resources</HResourcesGenerator_ClassName>
<HResourcesGenerator_AddResourcesFolder>true</HResourcesGenerator_AddResourcesFolder>
<HResourcesGenerator_WithSystemDrawing>false</HResourcesGenerator_WithSystemDrawing>
</PropertyGroup>
By default, it includes this code:
<ItemGroup Condition="$(HResourcesGenerator_AddResourcesFolder)">
<EmbeddedResource Include="Resources\**\*.*" />
<AdditionalFiles Include="Resources\**\*.*" />
</ItemGroup>
You can disable this behavior with <HResourcesGenerator_AddResourcesFolder>false</HResourcesGenerator_AddResourcesFolder>
Alternatives
Contacts
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on H.Resources.Generator:
Repository | Stars |
---|---|
HavenDV/H.NotifyIcon
TrayIcon for WPF/WinUI/Uno/MAUI
|
|
tryAGI/LangChain
C# implementation of LangChain. We try to be as close to the original as possible in terms of abstractions, but are open to new entities.
|
Version | Downloads | Last updated |
---|---|---|
1.6.0 | 4,654 | 12/2/2023 |
1.5.1 | 2,442 | 5/8/2023 |
1.5.0 | 2,360 | 3/9/2023 |
1.4.0 | 1,637 | 11/1/2022 |
1.2.28 | 2,138 | 7/13/2022 |
1.2.27 | 689 | 5/18/2022 |
1.2.26 | 394 | 5/18/2022 |
1.2.25 | 373 | 5/18/2022 |
1.2.24 | 415 | 5/18/2022 |
1.2.22 | 676 | 3/22/2022 |
1.2.21 | 525 | 2/2/2022 |
1.2.20 | 688 | 10/19/2021 |
1.2.19 | 433 | 8/6/2021 |
1.2.18 | 327 | 7/13/2021 |
1.2.17 | 316 | 7/13/2021 |
1.2.16 | 302 | 7/13/2021 |
1.1.15 | 338 | 7/13/2021 |
1.1.14 | 316 | 7/13/2021 |
1.1.13 | 332 | 7/13/2021 |
1.1.12 | 303 | 7/10/2021 |
1.1.11 | 311 | 7/10/2021 |
1.1.9 | 298 | 7/9/2021 |
1.1.8 | 299 | 7/6/2021 |
1.1.7 | 350 | 6/14/2021 |
1.1.6 | 331 | 6/14/2021 |
1.1.5 | 284 | 6/12/2021 |
1.1.4 | 278 | 6/12/2021 |
1.1.3 | 295 | 6/12/2021 |
1.1.2 | 322 | 6/12/2021 |
1.1.1 | 320 | 6/12/2021 |
1.0.5 | 662 | 4/11/2021 |
1.0.4 | 675 | 4/10/2021 |
1.0.3 | 292 | 4/10/2021 |
1.0.2 | 301 | 4/10/2021 |
1.0.1 | 307 | 4/10/2021 |
1.0.0 | 352 | 4/10/2021 |
⭐ Last 10 features:
To steps.
Test releases.
Lowered dotnet version requirements to run the generator.
Updated NuGet packages.
To use GetGlobalOption prefixes.
Updated H.Generators.Extensions.
Updated H.Generators.Extensions.
Added H.Generators.Extensions.
To IIncrementalGenerator.
Updated NuGet packages.
🐞 Last 10 fixes:
Fixed tests.
Fixed bug with resources with common ending.
AsStream and AsBitmap to public methods.
Fixed generated code.
Fixed static methods.
Fixed HResourcesGenerator_DefaultType behavior.
Check new syntax.
Fixed tests.
Changed base rule to Resources/**/*.*.
Fixed whitespaces.