Coping files from desktop to Windows Phone 7 Isolated Storage - windows-phone-7

I'm new to Phone 7 development.
I am trying to create an application the will load all the DLLs that I have created from a set location on the phone.
I have a basic menu application that will load all the DLLs I have created and display a list of then to the user using reflection to get an Icon out of the DLL and a description.
I have the following code to get all the dll but its not working
Dim cPlugins As New PluginCollection
Dim temp As String = System.Reflection.Assembly.GetExecutingAssembly.GetName().CodeBase.ToString
temp = System.Reflection.Assembly.GetExecutingAssembly.FullName
Dim strFolder As String = System.IO.Path.GetDirectoryName(temp)
strFolder = System.IO.Path.Combine(strFolder, "DLLS")
For Each strFile As String In System.IO.Directory.GetFiles(strFolder, "*.dll")
cPlugins.Add(New Plugin(strFile))
Next
The above code doesn't work and keeps returning a file not found error.
Any help please?

To retrieve the DLLs as resources you'll need to add them as embedded resources (build action) in the projet/XAP file.
This will not require you to copy them to isolated storage.
If you were copying them to isolated storage then you could put htem there with isolated storage explorer but this would only work for testing. For the live app you'd need to include them in the XAP and then copy them to isolated storage. As you don't neeed them in isolated storage to open them as resources to extract images then it would be unnecessary effort.
If possible, you coudl make things easier for yourself in the WP7 app by not embedding the images inside a DLL but this may not be practical if you are using the same images/DLLs across projects on multiple platforms. Even if this is the case I'd recommend considering adding a build step to you WP7 app to extract the images once at design time. This will mean your app has to do less. It will therefore able to be faster, have less opportunity for bugs and provide a better experience to the user.
Edit:
The issue is the way you are trying to query the files in IsolatedStorage. There is no need to calculate the actual path of your isolated storage location. Instead you should use the IsolatedStorageFile.GetFileNames Method. You'll use it like:
Using store As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
.... store.GetFileNames("/DLLS/*.dll")
End Using

The property Codebase isn't supported in Silverilght on the Phone. (See http://msdn.microsoft.com/en-us/library/system.reflection.assembly(v=VS.95).aspx) but you don't need to use this method to find the isolated storage location. Use the IsolatedStorageFile class instead.

Related

How to save files to AppData when using Microsoft Desktop App Converter to convert a Win32 app to UWP?

I have a game that was originally written in QuickBasic in the 1990's. I converted it into a Win32 app using QB64. I then used Microsoft's Desktop App Converter to package it as a UWP app and submit it to the Microsoft Store (it's been accepted).
The game seems to work fine, except for saving files. It throws a permission denied error whenever you try to save a file. From what I've been able to find thus far it seems that UWP apps can't save in the install directory and that is likely what my app is trying to do.
There are a number of code samples available online for taking a Win32 app written in C#, C, C++, etc. and having it use LocalAppData instead. Unfortunately, I'm not seeing anything that will help me with this application.
Is there a way to make saving files work in this instance? I'm hoping that there is perhaps a way to say, "Hey, when I say save a file, I mean save it to the LocalAppData folder for this particular application." This probably needs to be abstract, ideally a declarative part of the appx package that isn't in the QB64 code. Any ideas?
There are two options to fix it (and one way to hack it):
If the file saving is done from your code, change it to write to an accessible location instead, such as localappdata or temp.
If the file saving is done in code you can't change, then you can use the new Package Support Framework to apply a fixup at runtime that redirects the file operations. This is a new framework coming as part of the 1809 update for Windows 10. At the time of this writing this may not be an option for you just yet. Here is the documentation:
https://learn.microsoft.com/en-us/windows/uwp/porting/package-support-framework?context=/windows/msix/render
A hacky way to solve it that you could try would be to add a launcher EXE to your package and make that the app's entrypoint. The launcher would then copy your actual EXE to a writeable location (localappdata, etc.) and then launch it from there. All your file writes will then succeed.

Appcelerator with expansion files

Has anyone successfully used expansion files with appcelerator? I have found the module that is supposed to let us work with them, however I am running into the problem of the .obb file being downloaded directly from the play store and then being downloaded again with the module. Aside from that I can't seem to get access to any of the files contained within the .obb using the module.
I have heard all of the woes of having a big app, so please don't just tell me to make a smaller app, my client has a large "library" that they want installed directly on the app. It consists of html files that call javascript files and images through relative paths.
Are expansion files even the way to go with this? Should I simply zip up my files and download them after, unpack them, and access them using the file system? I am just looking for a way to get these large files onto the device and access them as if they were in the resources directory of the app.
Any help would be appreciated. thanks!
I have an app that needs over 300 PNG images and text files (to populate a database with) and could not get the app small enough to put up on the Play Store. What I ended up doing was create a barebones app (enough to get the user started) then I download the files on start up. I didn't mess with zipping everything (the data is constantly being updated), but if the information you have is pretty static, you could zip it. Once the download successfully finishes and installs the data, it sets an app property (Ti.App.Properties.setInt) 0 is never ran, 1 is partial download and 2 is download is installed (you can do this however you want, but that's what I did).

Windows Phone 7 attach data to XAP File

I am working on an music application and after long testing I have came to the conclusion that for the firs run I have to Load in the XAP File the Levels Data instead of downloading it from a web service because it is faster and not so time consuming.
My question is if someone knows a method to read the file listing inside an application folder.
I have written a method that copies the data from one folder to the LocalStorage of the application (IsolatedStorage) and all I need is a way to read the content of the folder.
I have to mention that this is my first app for windows phone.
If the file is in the application folder - which means it is packaged up in the xap - you should be able to get the file using the Application.GetRourceStream like I've seen with apps that have local databases they package, but want to copy over to Isolated Storage after install.
Here's an example (from this page http://msdn.microsoft.com/en-us/library/hh202860(v=vs.92).aspx):
Stream str = Application.GetResourceStream(new Uri("appdata:/MyReferenceDB.sdf", UriKind.Relative)).Stream;
appdata: is what tells it to look in the application directory. Only other option is isostore:
So you have already copied the file from your xap resources to Isolated Storage, and you want to read the file back out of Isolated Storage? (Is there a reason you can't just load the data out of the xap, without copying it to Isolated Storage?)
Try this tutorial on files and Isolated Storage: http://www.windowsphonegeek.com/tips/all-about-wp7-isolated-storage-read-and-save-text-files (I recommend reading the whole thing, but I linked specifically to a page on creating and reading text files).
This question contains code for listing the files in your isolated storage, if you can't just hardcode your filename:
windows phone 7 File Listing IsolatedStorage

Deploying Files to IsolatedStorage in Windows Phone 7

Hi everyone
I would like to know if it's possible to deploy my app assets directly to Isolated Storage once the app get deployed.
I'm currently extracting them from code but this make the app's first launch too slow and it will be declined once it's submitted to the marketplace.
I'm wondering if there is a nice trick to make the process faster
Thanks
There's no way to automatically deploy to IsolatedStorage on app installation.
There are a few things you can do to try and avoid a delay on first start up though:
Refer to files directly in the XAP where possible.
Split the assets into multiple dlls so that only those needed are loaded into memory.
Load content to IS in the background and prioritize this so that the resources are loaded as needed.
You should not need to load image or video files into IS just to view them.
You should only need to copy the XML files if they're going to be updated. If you just want to read some data this doesn't need to be done. Also, if the XML files just hold initial data/state this could be loaded from the assembly directed and only saved to IS when first persisted.

Move file from one folder to a different folder in VB6

I have a number of files in a give folder A. I want to move these files to folder B one by one. i.e., I am doing processing to every file. so after my own processing completes, I want to move the processed file to a different folder. How can I do that?
Please help!
The pure VB6 approach, without using FileSystemObject, is to copy then delete.
FileCopy src, dest
Kill src
Links to manual:
http://msdn.microsoft.com/en-us/library/aa243368(VS.60).aspx
http://msdn.microsoft.com/en-us/library/aa243388(VS.60).aspx
you can actually use the name function for moving files using VB
Name "c:/test1.txt" as "d:/temp/blabla.txt"
You probably want the FileSystemObject:
https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-1050078.html
Also, obviously you should upgrade and avoid any new vb6 development if possible. If you are .NET enabled however, you can do it much more easily in a .NET library and then expose the .NET component to COM for reference by your VB6 app. The only new requirement would really be that the app requires the .NEt Framework (which is standard now for windows installations). Another benefit of this is that if you later decide to upgrade the app to .NET you already have this functionality done!

Resources