embedded-resource

How can I access embedded resources in a C# project?

╄→гoц情女王★ 提交于 2019-11-27 06:57:23
问题 Most of the threads I've read about this question answer that you just have to access them like this: <MyProjectNamespace>.Properties.Resources.<MyResourceName> But at the build process I have this message: <MyProjectNamespace> does not contain a definition for 'Properties' It seems that the class 'Properties' is normally auto-generated by the IDE when you add resources to your project. The fact is that I'm working on Eclipse and I don't really know how to add resources, but I managed to

load resource as byte array programmatically

那年仲夏 提交于 2019-11-27 06:43:10
问题 I added image as file and set type as resource (see screenshot) How do I pull it out as byte array without using resx files, etc? 回答1: The process is described in How to embed and access resources by using Visual C#. Essentially it requires use of reflection, using the Assembly class. Stream imageStream = currentAssembly.GetManifestResourceStream("Resources.logo_foot.png"); See How to convert an Stream into a byte[] in C#? for details of how to get a byte[] from a Stream . 回答2: Things are

How to use shared resource file between projects in one solution?

纵饮孤独 提交于 2019-11-27 05:40:51
问题 I have a problem with resource files. I have a solution with two projects. The first project contains ImageResource.resx file with the images that I use. Every Form in this project can access this file from the designer. But I can see in the designer ImageResource.resx file to use it from second project ( Reference to second project is present ). I have added the ImageResource.resx file as a link to my second project. And I saw it in the designer! But when I use an image from this resource in

How to reference embedded images from CSS?

扶醉桌前 提交于 2019-11-27 05:25:09
问题 I have a CSS file that is embedded in my assembly. I need to set a background image for certain elements using this CSS file, and the image needs to be an embedded resource also. Is this possible? Is there any way I can reliably do this? I ran into the problem when putting an existing stylesheet into this dll then realized images weren't showing up. I don't know of any way to make it work though because I would need to know the URL to the embedded image. Has anyone done anything like this?

Accessing JAR resources

早过忘川 提交于 2019-11-27 04:53:12
I have a jar file with resources (mainly configuration for caches, logging, etc) that I want to distribute. I'm having a problem with the relative paths for those resources, so I did what I've found in another stackoverflow question, which said that this was a valid way: ClassInTheSamePackageOfTheResource.class.getResourceAsStream('resource.xml'); Sadly this does not work. Any ideas? Thanks! PS: Obviously I cannot use absolute paths, and I'd like to avoid environment variables if possible Make sure that your resource folder is listed as a source folder in your project settings. Also, make sure

How to refer to Embedded Resources from XAML?

筅森魡賤 提交于 2019-11-27 04:40:06
问题 I have several images that i want to be Embedded into the exe. When i set the Build Action to Embedded Resource I get through out the code an error that the Resource isn't available and asking me to set the Build Action to Resource I Tried several different methods : <ImageSource x:Key="Image_Background">YearBook;component/Resources/Images/darkaurora.png</ImageSource> <ImageSource x:Key="Image_Background">Images/darkaurora.png</ImageSource> <ImageSource x:Key="Image_Background">pack:/

How to read a resource file within a Portable Class Library?

和自甴很熟 提交于 2019-11-27 04:20:49
问题 I have a Portable Library which I am using for a Windows Phone application. In that same Portable Library, I have a couple of content files ( Build Action = Content ). I created a class DataReader in the Portable Library which is supposed to return me a stream to the content file. However, with the code below I am consistently getting back null from GetManifestResourceStream . What am I doing wrong? public class DataReader { public static Stream GetStream(string code) { string path = string

resource file in PyQt4

我的未来我决定 提交于 2019-11-27 03:32:47
问题 I'm trying to understand an example in PyQt4 (simpletreemodel.pyw) I see the code import simpletreemodel_rc But I can't see where the module is used in the example code When I examine the module simpletreemodel, I see: from PyQt4 import QtCore qt_resource_data = b"\ \x00\x00\x07\xb9\ \x47\ \x65\x74\x74\x69\x6e\x67\x20\x53\x74\x61\x72\x74\x65\x64\x09\x09\ \x09\x09\x48\x6f\x77\x20\x74\x6f\x20\x66\x61\x6d\x69\x6c\x69\x61\ \x72\x69\x7a\x65\x20\x79\x6f\x75\x72\x73\x65\x6c\x66\x20\x77\x69\ \x74\x68

Using custom VirtualPathProvider to load embedded resource Partial Views

谁都会走 提交于 2019-11-27 02:52:53
I wrote custom VirtualFile and VirtualPathProvider implementations that are successfully obtaining embedded resources that are Partial Views. However, when I attempt to render them it produces this error: The view at '~/Succeed.Web/Succeed.Web.Controls.SImporter._SImporter.cshtml' must derive from WebViewPage, or WebViewPage<TModel>. When rendering the partial view, inside of a regular View, it looks like the following: Html.RenderPartial("~/Succeed.Web/Succeed.Web.Controls.SImporter._SImporter.cshtml"); What is causing it to believe this isn't a partial view? EDIT: I Posted my code for both

Is there a Linux equivalent of Windows' “resource files”?

不羁岁月 提交于 2019-11-27 00:06:06
I have a C library, which I build as a shared object for Linux and a DLL for Windows with MinGW32. The API depends on a couple of data files (statistical models) which I'd really like to roll in with the SO/DLL so that deployment is just one file. It looks like I can achieve this for Windows with a "resource file" compiled with windres , but then I've got to write a bunch of resource-handling code for Windows, and I'm still stuck with the files on Linux. Is there a way to achieve the same functionality on Linux? Even better, is there a portable solution? It's actually quite simple on Linux and