Extra files in Windows Store app package - windows-8

just wondering if it's possible to include some files (one txt file in this case) in the app package that I need in the application folder. The thing is that I might use a piece of code that requires the license to be included in the app as a text file, and I think this would be one way to do it.
Thanks in advance.

Absolutely, it's really no different than including images for instance. And if you need to process the file within your app you can access it via its local path or explicitly use the ms-appx:/// protocol.
See How to reference content and How to load file resources for more details.

Just include the file in your project with Build Action set to Content. You can put it in any folder you like.
The file can then be accessed from the app either using the ms-appx: protocol or using the StorageFolder API:
var license = await Package.Current.InstalledLocation.GetFileAsync("license.txt");

Related

Dropwizard serve external images directory

I have a dropwizard API app and I want one endpoint where I can run the call and also upload and image, these images have to be saved in a directory and then served through the same application context.
Is it possible with dropwizard? I can only find static assets bundles.
There is similar question already: Can DropWizard serve assets from outside the jar file?
The above module is mentioned in the third party modules list of dropwizard. There is also official modules list. These two lists are hard to find maybe because the main documentation doesn't reference them.
There is also dropwizard-file-assets which seems new. I don't know which module will work best for your case. Both are based on dropwizard's AssetServlet
If you don't like them you could use it as example how to implement your own. I suspect that the resource caching part may not be appropriate for your use case if someone replace the same resource name with new content: https://github.com/dirkraft/dropwizard-file-assets/blob/master/src/main/java/com/github/dirkraft/dropwizard/fileassets/FileAssetServlet.java#L129-L141
Edit: This is simple project that I've made using dropwizard-configurable-assets-bundle. Follow the instructions in the README.md. I think it is doing exactly what you want: put some files in a directory somewhere on the file system (outside the project source code) and serve them if they exist.

Can I save into a specific folder?

While learning how to create Lua file output code with the support of LÖVE, I've always hated that LÖVE filesystem handler always saved the specific file somewhere in C:/Documents and Settings/...
How can I create a code that saves a file into a specific folder that I'd like to define (and maybe to change while running the application)?
The love.filesystem library doesn't let you do anything outside the sandbox. However, LÖVE doesn't disable Lua's built in io library, so you can use io.open to open files outside the sandbox and read/write them as normal, as well as other Lua functions like require and loadfile.
It also doesn't restrict loading of external modules, so you can (for example) require "lfs" to load LuaFileSystem and use that, if it is installed.

How to read a shortcut file (and get its target) in a Windows RT metro app?

I have accessed normal files and folders, but unable to read the target value from a shortcut file. Any idea how to read a shortcut file in WinRT?
My actual requirement is to find the most recently used/opened files in the system This info was previously available through Environment.GetFolderPath(Environment.SpecialFolder.Recent)
Thank you in advance :)
There is a file AppData\Local\recently-used.xbel which contains this information on Win8. Parsing it should be easy, but the problem will probably be to get access to this file as it isn't in the folders that can be accessed via any manifest declaration. Also the AppData folder is hidden, making it inaccessible via the FileOpenPicker.
My guess would be that this is an intentional change by Microsoft since it is no business of a sandboxed app, which documents were used by other apps. If you want to open files that were recently opened by your app, you can roll your own "recently changed" implementation. Which should be easy because you have to save their token to the FutureAccessList anyhow.

Packaging Windows 8 App Data File

I'm developing a Win 8 app and I would like to include a data file with the app. The data file will be unique for each user so it should really reside under /Users/(user)/AppData/Packages/(MyAppPackage)
Is is possible to do that with a deployment/installation package, and if so how?
Thanks.
As far as I know, CMIIW,
You cannot include the data file which your package, unless you put your data file in the application directory / installed directory, then after the first run, you can move it (the data file) to the /Users/(user)/AppData
I believe you will not save sensitive data to the Users/(user)/AppData, since the user can access to the folder with Windows Explorer easily, or if you must save it to AppData, I suggest you to encrypt your data first.
Cheers
Yusak Setiawan
http://apptivate.ms/apps/1271/mathboard

Using MEF with exporting project that uses resources (xml) contained in the xap

I'm doing a proof of concept app in SL4 using MEF and as part of the app I am importing another xap from an existing Silverlight Project and displaying it in my host project.
The problem is that the existing app uses some .xml files (as content) and it uses linq2xml to load these files which are (assumed to be) bundled in the xap.
When I compose the application the initalization fails because the host app doesn't contain the xml files. If I copy these xml files into the host project and run it the composition works fine. However, I need to keep the xml files in the original project.
Is there a way that I can download a xap and look at it's contents for xml files and then load them into the host xap at runtime so that after the compostion takes place the xml resources that are required can be found?
Or should I work out some kind of contract with an import/export to pass the xml files to the host xap?
As the people developing the imported xaps (should the project go ahead) are from a different company, I would like to keep changes to the way they develop their apps to a minimum.
I assume you are using the DeploymentCatalog to download the second xap? Unfortunately there's no way to get at resources included in that xap. You could have the resources embedded in assemblies which are included in the xap, and then modify the way they are loaded.
If you really don't want to change the way the secondary xap is structured, you might be able to write your own DeploymentCatalog which would also allow you to load resources from the downloaded xap. The source code to DeploymentCatalog is available, so you could base it off of that.
I've managed to find a solution that I'm fairly happy with.
Instead of building the .xml files as 'content' to go within the xap, I have built them as 'resource' then used Application.ResourceStream() and loaded the xml using a stream.
It means the second xap developers will have to change the way they operate, but its only one extra line of code and changing the Build Action, I'm sure they can handle.