Xamarin File Storage - file

Question:
I know how to Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SomeFile.txt");
But my question is when using emulator where does it store it or is it only in memory?
Thanks.

on Android, files are stored in the file system within the emulator image. You can use adb to access the files.
on iOS, the emulator file system is mapped onto the MacOS file system. You can get the full file path in code and then just access the files from Terminal or Finder

Related

Android Device File Explorer save database to local disk

I am using Android Studio 3.2.1 and I want to save database from emulator storage to my local disk. So I open device file explorer (DFE), select my database and click Save As. Everything is fine if I save small databases. If I try to save database more than 4 Mb, device file explorer hangs on and it look like this:
And I can't save database to local disk. How can I fix it or it is only problem with my IDE?
I have faced same problem too. Newer version of Android Studio has this bug.
The solution is adb command.
use this code inside Android Studio terminal:
adb exec-out run-as your.package.name cat databases/your_db_name > your_db_name
then goto your project directory such as:
C:\Users\your-PC\AndroidStudioProjects\MyApplication
now open the db file using any sqlite editor
Solved: The problem is in the Emulator SDK, specifically in the memory allocation of the Intel® HAXM ascelerator. The problem of Device File Explorer SaveAs was solved by increasing the memory, in my case, from 2Mb to 4Mb (the larger your file, you must give the ascelerator more memory)

Compiling applications from shared folders in a VM

I currently have many Linux VM's set up on VMware Workstation, there are some shared folders that contain source code that is held on the host computer. The issue I am having is that whenever I try to compile a file by using any compiler I get an Illegal seek error and file not recognized. Is there any way around this? I am using an Ubuntu 64-bit VM with Windows 7 as the host and the location of the shared files are on the Windows 7 hard drive.
I've run into a number of problems doing development over a network share in the past and suggest rather than sharing the files via SMB, you'll find more luck if you check in/out the files from a source control system (or simply copy them) so they're on a "local" drive on both the guest and host.

putting file on blackberry emulator file system

I need to put a video file on the file system of the Blackberry emulator to test the app I'm writing. I can't figure out how to do this. How can I copy a file from my computer's file system onto the simulator's file system?
In Eclipse or the JDE you can edit the properties for the simulator - one of those properties is to simulate an SD card. If you turn on this option, you can point to a directory on your hard drive and have it show up in the simulator as an SD card, including all of the files in that directory.
You can also comfortable access the storage via FTP, more details here:
https://developer.blackberry.com/develop/simulator/simulator_configuring.html

Environment.SpecialFolders in Silverlight 4 on Mac

Silverlight 4 running with elevated permissions provides access to certain special folders in the file system.
http://msdn.microsoft.com/en-us/library/system.environment.specialfolder(VS.95).aspx
These work great on Windows, but what do they map to on Mac OSX systems?
My application needs to access "My Documents". Will this map somewhere sensible on the mac?
Yes, but with a little trick.
You can create a file on windows even the containing folder does not exist, but on OS X your have to create the directory first. If not you will get an exception.
My code is as follow:
Directory.CreateDirectory(dirPath); // Not necessary on windows
FileStream newFs = File.Create(dirFile);
newFs.Close();
newFs.Dispose();
On OS X the "My Documents" folder is here:
/Users/[UserName]/Documents

Icons from remote files

I have started coding an FTP client application (for fun). I’m trying to represent remotely hosted files with icons. For example, let’s say I’m browsing the root folder of an FTP server (/) and want to display the Backup.zip file with the icon association from that client operating system. On some systems, this may be the windows compression icon and other operating systems this may be WinZip or WinRAR icons.
I have the client browsing local files with the SHGetFileInfo() function. This works great with files that are local, however, this function requires the physical file in order to retrieve the associated icon. So, this will not work with remotely hosted files. I have found some samples of loading icons given a file extension, and this is really where the question comes in... What would be the best strategy to get icons associated to remote files?
Go to the registry every time and look up extension to icon associations
Create 1 byte files with each extension and use the SHGetFileInfo() function for remote files (using local 1 byte files as association for remote files)
Other strategies???
What would a professional software company creating an FTP client do?
Thank you for your time.
-Jessy Houle
I suggest that you don't go to the registry every time: go if you need to, but if you've already been for a given filetype then remember/cache that result (within your program) and reuse it.
Use the procedure here from a previous Stack Overflow question on the same idea and uses the registry instead of an actual file.
How can I get the filetype icon that Windows Explorer shows?

Resources