embedded-resource

C# embedding images, reports, schemas

筅森魡賤 提交于 2019-12-24 10:58:38
问题 I've seen some examples, but trying to better understand how "Resource" files work, such as embedding images, reports, schemas, etc. If building an application, I want to make sure everything is available when deployed, but for things like reports and schemas, I don't want anyone accidentally deleting, renaming, or otherwise mucking around with the content of things. So, embedding these types of items appears to make sense. Then, I just access via the dll via the resources manager. Since I

Spring Security 4. CustomSecurityInternalResourceViewResolver

ぐ巨炮叔叔 提交于 2019-12-24 09:48:55
问题 I need configure my spring-boot web application to return different templates for same URL . Template should be returned checking roles for current user. To solve this issue i think should be used UrlBasedViewResolver to create\configure special CustomSecurityBasedInternalResourceViewResolver . It will be really good if someone will show how to implement this idea. 来源: https://stackoverflow.com/questions/38614453/spring-security-4-customsecurityinternalresourceviewresolver

Invalid parameter creating image or bitmap from stream c# XP only

て烟熏妆下的殇ゞ 提交于 2019-12-24 09:06:26
问题 I believe what I am doing is pretty standard. I create some images from embedded resources by calling GetManifestResourceStream on the resource, giving it the path to the .ico file: Bitmap bmp = new Bitmap(Assembly.GetEntryAssembly().GetManifestResourceStream("MeterView.Resources.unlocked.ico")); The bitmap is then used to display an image on my form. This has always worked perfectly on Windows 7 and 8, but now when I try to run the app on an XP SP3 box I get "Invalid Parameter" on the line

Playing embedded resource mp3 file

橙三吉。 提交于 2019-12-24 08:14:42
问题 I'm trying to play a mp3 file, which is embedded in my c# application (winforms) but with no result. I don't want to create a file from the resource and play it. I've searched the internet but haven't found any working examples. All of them are creating a file from the resource and save it, then pass the file path to mci or wmp. Is it possible to pass a stream? public partial class Form1 : Form { [DllImport("winmm.dll")] private static extern long mciSendString(string lpstrCommand,

Access to csv file in jar

风格不统一 提交于 2019-12-24 06:38:22
问题 I tried everything to access to csv file when a run my jar. I put the csv in resources package in Eclipse, and it's fine when I run the code from this, but it doesn't work when I run the jar from an executable. ClassLoader c = MyClass.class.getClassLoader(); URL url = c.getResource("com/mysoft/resources/"); String path = URLDecoder.decode(url.getPath(), "utf-8"); File f = new File(path+ "VAL.csv"); if(f.exists()) ... I don't want to put this file out of the jar. I just want read the file, how

How can I prevent embedded resource file culture being set based on its filename

老子叫甜甜 提交于 2019-12-24 04:14:06
问题 In a VS2015 .NET 4.6.1 project, I have a data resource file with a Build Action set to 'Embedded Resource' and a name as follows: myDataFile.bin.zip Unfortunately 'bin' is a locale that is present on my Windows 10 machine, which is causing the file to be identified as a resource for a specific locale, rather than the default one (Visual Studio seems to recognise files named in the format <name>.<locale>.<ext> as being specific to a locale), resulting in the creation of a satellite assembly.

Issue loading custom font

陌路散爱 提交于 2019-12-24 00:28:11
问题 I am attempting to load a font, in slick2d, which (in eclipse) is located at: "resources\fonts\slkscr.ttf" with the following code: private void loadResources() { try { Font fontRaw = Font.createFont(Font.TRUETYPE_FONT, new BufferedInputStream(Game.class.getClassLoader(). getResourceAsStream("resources/fonts/slkscr.ttf"))); Font fontBase = fontRaw.deriveFont(Font.PLAIN, 20); this.font = new TrueTypeFont(fontBase, false); } catch (IOException e) { e.printStackTrace(); } catch

Haxe — Embed files like in ActionScript?

主宰稳场 提交于 2019-12-23 21:07:42
问题 In ActionScript, you can do something like this: [Embed(source = "src/myfile.xml", mimeType = "application/octet-stream")] private var xml : Class; and it will embed your file to be used in code. How can i do something similar in Haxe? 回答1: Haxe allows you to provide external resources info for embedding in hxml. You may refer to the doc. 回答2: Things have changed since the time the question was asked. With a modern version of haxe one can do: @:bitmap("test.png") class TestBMD extends

Reading a Text File From a .jar File

旧城冷巷雨未停 提交于 2019-12-23 13:08:09
问题 I have a rookie question. I'm currently writing a program that takes in alot of data from a text file using the File and Scanner class as shown below: File data = new File("champdata.txt"); Scanner read = new Scanner(data); read.useDelimiter("%"); The Scanner then retrieves data from the text file correctly while in the IDE, but when I run the program as a .jar file, the file cannot be retrieved. I've read a little about adding a text file to the .jar file itself, and using the InputStream

Creating and executable JAR file that uses an external XML file

三世轮回 提交于 2019-12-23 02:29:13
问题 I have a java application in Eclipse that uses an eml file like so File matches = new File("matches.xml"); The file is located in the default package as all the other classes. When I create the JAR it bundles in the XML file with it. My application require me to be able to make changes to the XML file. How can I set it up so the JAR can reference the XML file outside of itself? 回答1: My application require me to be able to make changes to the XML file. Then you will need to extract it from the