Esempio n. 1
0
        private static void USBDevice_Connected(USBH_Device device)
        {
            if (device.TYPE == USBH_DeviceType.MassStorage)
            {
                Drive drive = new Drive()
                {
                    Device = device
                };

                try
                {
                    drive.Storage = new PersistentStorage(device);
                    drive.Storage.MountFileSystem();
                    drives.Add(drive); // Add drive to Array
                }
                catch (Exception)      // e)
                {
                    //Debug.Print("couldn't mount!\n" + e.Message);
                }
            }
        }
Esempio n. 2
0
        private static void USBDevice_Connected(USBH_Device device)
        {
            if (device.TYPE == USBH_DeviceType.MassStorage)
            {
                Drive drive = new Drive() { Device = device };

                try
                {
                    drive.Storage = new PersistentStorage(device);
                    drive.Storage.MountFileSystem();
                    drives.Add(drive); // Add drive to Array
                }
                catch (Exception)// e)
                {
                    //Debug.Print("couldn't mount!\n" + e.Message);
                }
            }
        }
Esempio n. 3
0
        private static void RemovableMedia_Inserted(object sender, MediaEventArgs e)
        {
            // Because of how this is called we have no choice
            // But to assume this is always the last mounted PS

            if (e.Volume.RootDirectory != "\\SD") // USB
            {
                try
                {
                    Drive drive = (Drive)drives[drives.Count - 1];
                    drive.VolumeInfo = e.Volume;
                    drives[drives.Count - 1] = drive;
                }
                catch (Exception) { }
            }
            else
            {
                Drive drive = new Drive()
                {
                    VolumeInfo = e.Volume,
                    Storage = sdCard
                };
                drives.Add(drive);
            }

            // Attempt to get the drive name
            //try
            //{
            //    string sFile = @e.Volume.RootDirectory + "\\volume.info";
            //    if (File.Exists(sFile))
            //    {
            //        Debug.Print("Found volume.info for " + e.Volume.RootDirectory);
            //        byte[] b = new byte[new FileInfo(sFile).Length];
            //        FileStream iFile = new FileStream(sFile, FileMode.Open, FileAccess.Read);
            //        iFile.Read(b, 0, b.Length);
            //        iFile.Close();
            //        Debug.Print(new string(System.Text.UTF8Encoding.UTF8.GetChars(b)));
            //    }
            //}
            //catch (Exception) { }

            if (DriveAdded != null)
                DriveAdded(e.Volume.RootDirectory);
        }