So I created a drop in replacement for Microsoft’s System.IO library. I started with an exact port of System.IO and then added the CIFS support along with a few teaks. Normal FileStreams can be used for local or CIFS file. All Copy/Move/Delete commands for File/Directory work both locally and over the nework.
For example you can call File.Delete(“\sd\file.ext”) or File.Delete(“\192.168.0.12\dir\file.ext”). You can also copy between local/network just as you would locally.
If there’s any interest I’ll post it up in CodeShare.
Happy to throw more in there while I’m at it. Anything in particular you want to see? For example I’ve already added AbsolutePath, the ability to search by pattern in GetFiles/GetDirectories, change the copy/move buffer size, etc.
@ Skewworks - I can remeber one missing Feature in my CIFS lib:
So far it only Supports plain text Password authentification. For the more safe one’s encryption is required, but I could not find the correct functions in the crypto lib. I think CIFS Needs DES (or similar?) but I could only find TrippleDES (or similar?).
@ Reinhard Ostermeier - Hadn’t run into that issue, but I’m just working with my local PC. I do remember there was an issue with adding additional directories under a root or something like that. I patched the up the first day. Otherwise, I’ve never had an issue w/ your library. It’s rock solid and I’ve used it to deploy my tests for over a year now (maybe even 2?).
@ Skewworks - Using Plain Text Password usually works fine. I tested with several different Windows OS and NAS without any issue.
It’s only a security issue, since the Password for the Network share is transmitted as plain text over the Network.
btw. you should cache the MethodInfo objects of all methods you are calling in static fields. Reflection is expencive.
Also, if there are multiple overloads (with different Parameters) of a method, you might get the wrong one. There is an Overload to Type.GetMethod() that allows you to specify the Parameter types (at least in full .NET, not 100% sure for NETMF).
@ Reinhard Ostermeier - Good point on the static methods, I’ll update my code to cache them. As far as overloads these are unmanaged calls with single signatures so no worries on that front.
The only issue I’ve run into is invoking a method with an out parameter. Everything I’ve found for addressing it requires items that aren’t implemented in NETMF. Luckily there’s only one call that does it and it can be pretty safely ignored. The method in question gets canRead/canWrite/canSeek which I obtain other ways.