Reputation: 737
I've been messing around with Mono for Android for a little while now. I am wondering how (or if it's possible) to access network files located on my NAS.
I was really hoping it was going to be as easy as
var files = System.IO.Directory.GetFiles("\\NAS-NAME\SomeDirectory\", "*");
Unfortunately, I'm getting this error message, so I'm guessing it's not quite as straight forward as a standard .NET application:
Unhandled Exception:
System.IO.DirectoryNotFoundException: Directory '\\NAS-NAME\SomeDirectory\' not found.
Upvotes: 1
Views: 484
Reputation: 13600
I'm guessing it's not quite as straight forward as a standard .NET application:
Standard .NET applications have all of WinAPI to build upon, e.g. FileStream.Write
uses WinAPI WriteFile
, which supports UNC paths. Android is Linux, and thus doesn't have a "complete" WinAPI implementation, and CIFS/SMB is beyond the scope of Mono for Android (and normal Mono for that matter), hence the error.
You should try using an alternate networking protocol, e.g. does your NAS support WebDAV? There are a number of C# WebDAV libraries that can be easily ported to Mono for Android...
Upvotes: 1