c # – Load stored textures as embedded resources?

I am currently trying to rewrite some of my loading methods and have found the methods that load textures. I would like to store the texture files inside the project instead of on the hard drive when the project is implemented. The way to do it is simply to configure these textures as resources embedded within the project structure.

I have achieved this, and I can effectively upload simple data files such as TXT Y xml getting a Current to the object through:

using System.IO;
using System.Reflection;
Public static stream GetEmbeddedResource (string resource) {
string QualifiedPath = $ "ProjectName. {resource}";
return Assembly.GetExecutingAssembly (). GetManifestResourceStream (verifiedPath);

Then I can access the data in those files easily using things like StreamReader. However, some of the DirectX11 the types use a complete file path to load files; For example, I charge my sprite textures like this:

using (Factory of ImagingFactory = new ImagingFactory ()) {
using (NativeFileStream fileStream = new NativeFileStream (imageFileLocation, NativeFileMode.Open, NativeFileAccess.Read)) {
using (BitmapDecoder decoder = new BitmapDecoder (factory, fileStream, DecodeOptions.CacheOnDemand)) {
using (BitmapFrameDecode frame = decoder.GetFrame (0)) {
using (Converter FormatConverter = new FormatConverter (factory)) {
converter.Initialize (frame, PixelFormat ...);
bitmap = Bitmap1.FromWicBitmap (Context2D, converter);

This is a simple process and all I need to do is specify a file path to the image, such as C: TestData MyImage.jpg.

  • Is there a way to do the same with the Current object of System.IO or there is a way to get the file path from the Current Object still achieve this?
  • There's a DirectX11 equivalent to me GetEmbeddedResource method (or at least the method used in that particular method)?

I suppose that, since the file is an embedded resource, no file path would be available.