embedded-resource

Embedded resources in assembly containing culture name in filename will not load

一笑奈何 提交于 2019-12-04 05:58:44
I'm trying to embed some email templates in a class library. This works fine, until I use a filename containing a culture-name with the following notation: templatename.nl-NL.cshtml The resource does not seem to be available. Example code: namespace ManifestResources { class Program { static void Main(string[] args) { var assembly = Assembly.GetExecutingAssembly(); // Works fine var mailTemplate = assembly.GetManifestResourceStream("ManifestResources.mailtemplate.cshtml"); // Not ok, localized mail template is null var localizedMailTemplate = assembly.GetManifestResourceStream(

Loop through embedded resources of different languages/cultures in C#

ε祈祈猫儿з 提交于 2019-12-04 05:44:24
One level up from this question , what would be the way to store all (and loop through) available resources and associated cultures, to allow user selection of a specific culture? Further explanation: Suppose three resource files: GUILanguage.resx GUILanguage.fr.resx GUILanguage.it.resx I could have a string in each called LanguageName . How would I be able to programmatically loop through the different LanguageName values to list them (in say a list box)? EDIT: WinForms project, embedded resources. Here is a solution I think works for Winforms: // get cultures for a specific resource info

Accessing resources from code for setting NotifyIcon.Icon

假装没事ソ 提交于 2019-12-04 05:19:38
I am trying to get the Icon of a NotifyIcon in WPF. So I have added a .ico file to my solution in a Resources folder and set the build action to Resource . I am trying to grab this resource in code behind like so: var icon = (Icon) Application.Current.FindResource("/Resources/icon.ico") This doesn't work. In addition to this: Application.Current.Resources.Count returns 0 . EDIT var i = new Icon(Application.GetResourceStream(new Uri("/systemtrayicon.ico", UriKind.Relative)).Stream); With the icon in the root and the build action set to Resource . Still not working. EDIT AGAIN: I needed to Clean

Using resource files in Java

眉间皱痕 提交于 2019-12-04 05:05:39
问题 I'm just getting into using "Java Resource Files" and i have a few questions... I am hoping to distribute my program to others and I'm assuming JAR file isn't the best way. I'd probably go about it by "converting to exe" is this good practice? what are the limitations? If I convert to an exe does it keep the resource files? I'm actually just trying to use a resource file. This file is a text file and will just save the users directories for certain files so they don't need set them up every

Why getResourceAsStream method is in Class class?

送分小仙女□ 提交于 2019-12-04 04:53:06
Why public InputStream getResourceAsStream(String name) is in Class class? It just give inputstream of file which is in jar file and there is no relation with Class class. so it can be static method and it can be in any class. There is a relationship to the class: The package of the class is taken into account - if you give call getResourceAsStream("baz.txt") on the class for foo.bar.SomeClass it will look for /foo/bar/baz.txt The classloader is taken into account to find the resources in the first place - if it were a static method, how would it know which jar files (etc) to look in? There's

How do package managed C# dlls with a managed C# application without leaving behind files?

走远了吗. 提交于 2019-12-04 02:38:56
问题 I've read through the two other threads that extract the dll from the application at run time. One of these methods used the current Windows temporary directory to save the dll in, but it was an unmanaged dll and had to be imported at runtime with DllImport . Assuming that my managed dll exported to the temporary directory, how can I properly link that managed assembly to my current MSVC# project? 回答1: You dont need to save to a temp directory at all. Just put the managed dll as an 'Embedded

WebResource Hell - resource cannot be found

落爺英雄遲暮 提交于 2019-12-03 23:36:23
Marked a javascript file as "Embedded resource" Added WebResource attribute to my AssemblyInfo class Now i'm trying to output the embedded javascript to my master page. All I'm getting is a "Web Resource not found" from the web resource url. Project Assembly Name: CompanyProduct Project Default Namespace: Company.Product.Web Javascript file located: Library/navigation.js AssemblyInfo: [assembly: WebResource("CompanyProduct.Library.navigation.js", "text/javascript")] Code in master page: Page.ClientScript.RegisterClientScriptInclude("NavigationScript", Page.ClientScript.GetWebResourceUrl(this

how to play videos in .avi file format in chrome?

不羁的心 提交于 2019-12-03 22:14:28
问题 Technically It was possible to play .avi files by loading an embedded object for a external player directly in the HTML. Now chrome deprecated that capabitilities and the solution left it's to transcode all my video files into .mp4 Edited Because I don't own the files I don't pretend to transcode them. I'm looking forward for a way to re-enable the old embedded objects to play those files into the browser. Chrome is required For firefox a solution would be: <!DOCTYPE html> <html> <head>

change embedded resource file during runtime

人走茶凉 提交于 2019-12-03 17:27:31
I have a written a program that uses a resource (embedded TEXT file) for the programs default configuration. i want to be able to allow users to change this default behavior. i would like to know how to modify the embedded resource file so that following times program is used it would use the modified version. appreciate the help I think what you are looking for is a settings file. The embedded resources are compiled into your exe/dll and are not meant to be modified. Pranay Rana here is one way to update file which is embedded in the project , here is an example of xml file. You can change it

MissingManifestResourceException on Windows Phone 8.1 with .resx resources

元气小坏坏 提交于 2019-12-03 15:52:17
问题 I'm developing a Windows Phone 8.1 app that also targets Android(Xamarin) As ever I added my string resources(.resx) on a PCL and referenced them on my launcher project to use it on my views, this all works fine on WP 8.1 silverlight but on the WinRt when I configure the project to release and run it on a device, for some reason I always get a MissingManifestResourceException. I've tried every solution for this problem out there without any success. Note that on the emulator everything works