public void Download(string path, CancellableProgress progress, Action <Stream> success, Action <Exception> failure) { FileStream stream = default(FileStream); Exception e = default(Exception); ThreadPool.QueueUserWorkItem(delegate { try { InitializeFilesystemAccess(); string path2 = ToInternalPath(path); stream = new FileStream(path2, FileMode.Open, FileAccess.Read, FileShare.Read); Dispatcher.Dispatch(delegate { success(stream); }); } catch (Exception ex) { e = ex; Dispatcher.Dispatch(delegate { failure(e); }); } }); }
public void List(string path, CancellableProgress progress, Action <ExternalContentEntry> success, Action <Exception> failure) { ExternalContentEntry entry = default(ExternalContentEntry); Exception e = default(Exception); ThreadPool.QueueUserWorkItem(delegate { try { InitializeFilesystemAccess(); string internalPath = ToInternalPath(path); entry = GetDirectoryEntry(internalPath, scanContents: true); Dispatcher.Dispatch(delegate { success(entry); }); } catch (Exception ex) { e = ex; Dispatcher.Dispatch(delegate { failure(e); }); } }); }
public void Upload(string path, Stream stream, CancellableProgress progress, Action <string> success, Action <Exception> failure) { Exception e = default(Exception); ThreadPool.QueueUserWorkItem(delegate { try { InitializeFilesystemAccess(); string uniquePath = GetUniquePath(ToInternalPath(path)); string po = uniquePath; if (po.StartsWith("android:")) { po = Storage.GetSystemPath(po); } string pp = Storage.GetDirectoryName(po); Directory.CreateDirectory(pp); using (FileStream destination = new FileStream(po, FileMode.Create, FileAccess.Write, FileShare.None)) { stream.CopyTo(destination); } Dispatcher.Dispatch(delegate { success(null); }); } catch (Exception ex) { e = ex; Dispatcher.Dispatch(delegate { failure(e); }); } }); }
public void Login(CancellableProgress progress, Action success, Action <Exception> failure) { failure(new NotSupportedException()); }
public void Link(string path, CancellableProgress progress, Action <string> success, Action <Exception> failure) { failure(new NotSupportedException()); }