Ejemplo n.º 1
0
        public static void VolumeInserted(int aMask)
        {
            // -------------------------
            // A volume was inserted
            // -------------------------
            //MessageBox.Show("Volume inserted in " + deviceMonitor.MaskToLogicalPaths(aMask));
            //lbEvents.Items.Add("Volume inserted in " + fNative.MaskToLogicalPaths(aMask));

            bool          skipDVDMenu = false;
            string        discName;
            DriveInfo     driveInfo;
            InsertedMedia insertedMedia = new InsertedMedia();

            bool.TryParse(System.Configuration.ConfigurationManager.AppSettings["Media.SkipDVDMenu"], out skipDVDMenu);
            insertedMedia.SkipMenu = skipDVDMenu;
            insertedMedia.ShowDialog();
            string driveLetter = deviceMonitor.MaskToLogicalPaths(aMask);

            driveInfo = new DriveInfo(driveLetter);
            discName  = driveInfo.VolumeLabel;

            //discName = discName.Replace("<", "");
            //discName = discName.Replace(">", "");
            //discName = discName.Replace("[", "");
            //discName = discName.Replace("]", "");
            discName = System.Text.RegularExpressions.Regex.Replace(discName, @"\W*", "");

            //switch (insertedMedia.MediaState)
            //{
            //    case MediaStateEnum.Play:
            //        playRemoveableMedia(driveLetter, insertedMedia.SkipMenu);
            //        break;
            //    case MediaStateEnum.PlayAndRecord:
            //        playRemoveableMedia(driveLetter, defaultPathToSaveTo + "\\" + discName + ".CEL", insertedMedia.SkipMenu);
            //        break;
            //    case MediaStateEnum.Record:
            //        recordRemoveableMedia(driveLetter, defaultPathToSaveTo + "\\" + discName + ".CEL", insertedMedia.SkipMenu);
            //        break;
            //}
        }
Ejemplo n.º 2
0
        private void VolumeInserted(int aMask)
        {
            // -------------------------
            // A volume was inserted
            // -------------------------
            //MessageBox.Show("Volume inserted in " + deviceMonitor.MaskToLogicalPaths(aMask));
            //lbEvents.Items.Add("Volume inserted in " + fNative.MaskToLogicalPaths(aMask));
            bool          skipDVDMenu = false;
            string        discName;
            string        driveLetter = deviceMonitor.MaskToLogicalPaths(aMask);
            DriveInfo     driveInfo;
            InsertedMedia insertedMedia = new InsertedMedia();

            driveInfo = new DriveInfo(driveLetter);

            bool.TryParse(System.Configuration.ConfigurationManager.AppSettings["Media.SkipDVDMenu"], out skipDVDMenu);
            insertedMedia.SkipMenu = skipDVDMenu;
            insertedMedia.Drive    = driveInfo;
            insertedMedia.ShowDialog(this);

            discName = insertedMedia.MediaName;

            switch (insertedMedia.MediaState)
            {
            case MediaStateEnum.Play:
                playRemoveableMedia(driveLetter, insertedMedia.SkipMenu);
                break;

            case MediaStateEnum.PlayAndRecord:
                playRemoveableMedia(driveLetter, defaultPathToSaveTo + "\\" + discName + ".CEL", insertedMedia.SkipMenu);
                break;

            case MediaStateEnum.Record:
                recordRemoveableMedia(driveLetter, defaultPathToSaveTo + "\\" + discName + ".CEL", insertedMedia.SkipMenu);
                break;
            }
        }