CERB40 FileSystem support in OSHW

Hello all

I am trying to open a file on a SD card connected to a Cerb40 device (OSHW library) but I cannot find references to FileStream nor Directory classes (I expected them to be in System.IO).

The mounting of the SD card is ok and the volume seems to report correct values. Am I missing an assembly reference?

My references are:

  • GHI.Hardware.FEZCerb
  • GHI.OSHW.Hardware
  • Microsoft.SPOT.IO
  • Microsoft.SPOT.Native
  • mscorlib

My code

using System;
using Microsoft.SPOT;
using GHI.OSHW.Hardware;
using System.IO;
using Microsoft.SPOT.IO;

namespace MFConsoleApplication2
{
public class Program
{
public static void Main()
{
Debug.Print(
Resources.GetString(Resources.StringResources.String1));

        StorageDev.MountSD();

        var volume = VolumeInfo.GetVolumes()[0];
        var root = volume.RootDirectory;

        var space = volume.TotalFreeSpace;
        Debug.Print(space.ToString());

        using (var file = new FileStream("\\SD\\test.txt", FileMode.Open))  // Where is FileStream ? System.IO ???
        {
        }


        Debug.Print(root);

        StorageDev.UnmountSD();
    }
}

}

Thanks
Luc

Did you add the reference in visual studio?

Edit:

I see you are missing reference for System.IO.dll

Hello Architect

I was confused about required assemblies probably because some classes of System.IO namespace seems to be implemented outside System.IO.dll (Stream, IOException …)

Thx, works fine now
Luc

You are welcome.

I see the confusion. Think about namespaces as “logical” grouping for classes and assemblies are “physical” containers. When CLR loads an assembly it will put all classes into different “piles” according with their namespace. So later on when it runs your code it will look/search only in the “piles” you have specified with “using” statement.