H.Resources.Generator 1.2.25

There is a newer version of this package available.
See the version list below for details.
dotnet add package H.Resources.Generator --version 1.2.25                
NuGet\Install-Package H.Resources.Generator -Version 1.2.25                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="H.Resources.Generator" Version="1.2.25">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add H.Resources.Generator --version 1.2.25                
#r "nuget: H.Resources.Generator, 1.2.25"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install H.Resources.Generator as a Cake Addin
#addin nuget:?package=H.Resources.Generator&version=1.2.25

// Install H.Resources.Generator as a Cake Tool
#tool nuget:?package=H.Resources.Generator&version=1.2.25                

H.Resources.Generator

Language License Requirements Build Status

Nuget

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

There are no supported framework assets in this package.

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 (3)

Showing the top 3 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.
HavenDV/DependencyPropertyGenerator
Dependency property, routed event and weak event source generator for WPF/UWP/WinUI/Uno/Avalonia/MAUI platforms.
Version Downloads Last updated
1.6.0 7,467 12/2/2023
1.5.1 2,459 5/8/2023
1.5.0 2,412 3/9/2023
1.4.0 1,645 11/1/2022
1.2.28 2,140 7/13/2022
1.2.27 690 5/18/2022
1.2.26 395 5/18/2022
1.2.25 374 5/18/2022
1.2.24 416 5/18/2022
1.2.22 679 3/22/2022
1.2.21 527 2/2/2022
1.2.20 691 10/19/2021
1.2.19 437 8/6/2021
1.2.18 330 7/13/2021
1.2.17 318 7/13/2021
1.2.16 304 7/13/2021
1.1.15 341 7/13/2021
1.1.14 318 7/13/2021
1.1.13 334 7/13/2021
1.1.12 306 7/10/2021
1.1.11 314 7/10/2021
1.1.9 302 7/9/2021
1.1.8 302 7/6/2021
1.1.7 362 6/14/2021
1.1.6 334 6/14/2021
1.1.5 286 6/12/2021
1.1.4 281 6/12/2021
1.1.3 296 6/12/2021
1.1.2 323 6/12/2021
1.1.1 322 6/12/2021
1.0.5 696 4/11/2021
1.0.4 708 4/10/2021
1.0.3 295 4/10/2021
1.0.2 304 4/10/2021
1.0.1 311 4/10/2021
1.0.0 361 4/10/2021

⭐ Last 10 features:
- feat: Updated H.Generators.Extensions. 2022-05-19
- feat: Added H.Generators.Extensions. 2022-05-18
- feat: To IIncrementalGenerator. 2022-03-22
- feat: Updated NuGet packages. 2021-10-19
- feat: To C# 10 and net6.0. 2021-10-19
- feat: Deleted types. Added Resource and As methods. 2021-07-13
- feat: Added HResourcesGenerator_DefaultType property. 2021-07-13
- feat: Added HResourcesGenerator_AutoDetect global property. 2021-07-13
- feat: Added extension to resource name. 2021-07-10
- feat: Added implicit Resources folder ItemGroup. 2021-07-06
🐞 Last 10 bug fixes:
- fix: Fixed tests. 2022-05-18
- fix: Fixed bug with resources with common ending. 2022-02-02
- fix: AsStream and AsBitmap to public methods. 2021-08-07
- fix: Fixed generated code. 2021-07-14
- fix: Fixed static methods. 2021-07-14
- fix: Fixed HResourcesGenerator_DefaultType behavior. 2021-07-13
- fix: Check new syntax. 2021-07-10
- fix: Fixed tests. 2021-07-10
- fix: Changed base rule to Resources\**\*.*. 2021-07-10
- fix: Fixed whitespaces. 2021-06-13