using System;
using System.Threading;
using GHI.Usb.Client;
using GHI.Usb;
using GHI.IO.Storage;

namespace USB_MSC
{
    public class Program
    {
        public static void Main()
        {
            // Start MS
            MassStorage ms = new MassStorage();
            Controller.ActiveDevice = ms;

            // Assume SD card is connected
            SDCard sd;
            Thread.Sleep(250);
            try
            {
                sd = new SDCard();
            }
            catch
            {
                throw new Exception("SD card not detected");
            }
            Thread.Sleep(250);
            ms.AttachLogicalUnit(sd, 0, " ", " ");
            Thread.Sleep(250);
            // enable host access 
            ms.EnableLogicalUnit(0);

            Thread.Sleep(Timeout.Infinite);
        }

    }
}
