Uno.MvvmCross/File
Tomasz Cielecki 7871b9d521 Update nuget packages + fix output path for WPF 2016-07-05 12:20:39 +02:00
..
MvvmCross.Plugins.File Update nuget packages + fix output path for WPF 2016-07-05 12:20:39 +02:00
MvvmCross.Plugins.File.Droid Update nuget packages + fix output path for WPF 2016-07-05 12:20:39 +02:00
MvvmCross.Plugins.File.WindowsCommon Update nuget packages + fix output path for WPF 2016-07-05 12:20:39 +02:00
MvvmCross.Plugins.File.WindowsPhone Update nuget packages + fix output path for WPF 2016-07-05 12:20:39 +02:00
MvvmCross.Plugins.File.WindowsStore Update nuget packages + fix output path for WPF 2016-07-05 12:20:39 +02:00
MvvmCross.Plugins.File.Wpf Update nuget packages + fix output path for WPF 2016-07-05 12:20:39 +02:00
MvvmCross.Plugins.File.iOS Update nuget packages + fix output path for WPF 2016-07-05 12:20:39 +02:00
Readme.md Add readme for all plugins 2015-09-04 22:47:34 +02:00

Readme.md

File

The File plugin provides cross-platform access to a File Store API:

public interface IMvxFileStore
{
    bool TryReadTextFile(string path, out string contents);
    bool TryReadBinaryFile(string path, out Byte[] contents);
    bool TryReadBinaryFile(string path, Func<Stream, bool> readMethod);
    void WriteFile(string path, string contents);
    void WriteFile(string path, IEnumerable<Byte> contents);
    void WriteFile(string path, Action<Stream> writeMethod);
    bool TryMove(string from, string to, bool deleteExistingTo);
    bool Exists(string path);
    bool FolderExists(string folderPath);
    string PathCombine(string items0, string items1);
    string NativePath(string path);

    void EnsureFolderExists(string folderPath);
    IEnumerable<string> GetFilesIn(string folderPath);
    void DeleteFile(string path);
    void DeleteFolder(string folderPath, bool recursive);
}

This plugin is implemented on all platforms - except WindowsStore where the Folder APIs are currently unimplemented.

By defautlt, the plugin reads and writes files in paths relative to:

  • Android - Context.FilesDir
  • iOS - Environment.SpecialFolder.MyDocuments
  • WindowsPhone - app-specific isolated storage
  • WindowsStore - Windows.Storage.ApplicationData.Current.LocalFolder.Path
  • Wpf - Environment.SpecialFolder.ApplicationData

Note: while it works, the use of a synchronous API for File IO on WindowsStore applications is slightly 'naughty'. It's likely that an asynchronous version of the IMvxFileStore interface will be provided in the near future.