Exemplo n.º 1
0
        /// <summary>
        /// saving settings
        /// </summary>
        public void Save()
        {
            OMLSettings.MountingToolUseAdvanced = this.EnableImageMounting.Value;
            if (this.EnableImageMounting.Value)
            {
                MountingTool.Tool tool = MountingTool.Tool.None;

                switch (this.mountingToolChoice.ChosenIndex)
                {
                case 0:
                    tool = MountingTool.Tool.DaemonTools;
                    break;

                case 1:
                    tool = MountingTool.Tool.VirtualCloneDrive;
                    break;

                default:
                    tool = MountingTool.Tool.None;
                    break;
                }

                OMLSettings.MountingToolPath      = MountingTool.GetMountingToolPath(tool);
                OMLSettings.MountingToolSelection = tool;

                OMLSettings.VirtualDiscDrive = virtualDriveOptions.Chosen.ToString().Replace(@":\", "");
            }
            else
            {
                OMLSettings.MountingToolSelection = MountingTool.Tool.None;
                OMLSettings.MountingToolPath      = string.Empty;
                OMLSettings.VirtualDiscDrive      = string.Empty;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// saving settings
        /// </summary>
        public void Save()
        {
            if (this.enableSave == true)
            {
                MountingTool.Tool tool = MountingTool.Tool.None;

                switch (this.mountingToolChoice.Chosen.ToString())
                {
                case "DAEMON Tools Lite":
                    tool = MountingTool.Tool.DaemonTools;
                    break;

                case "Virtual CloneDrive":
                    tool = MountingTool.Tool.VirtualCloneDrive;
                    break;

                default:
                    tool = MountingTool.Tool.None;
                    break;
                }
                if (this.EnableImageMounting.Value == false)
                {
                    tool = MountingTool.Tool.None;//set it to none if we have disabled it
                }
                OMLSettings.MountingToolPath      = MountingTool.GetMountingToolPath(tool);
                OMLSettings.MountingToolSelection = tool;

                OMLSettings.VirtualDiscDrive = virtualDriveOptions.Chosen.ToString().Replace(@":\", "");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Mounts an image and returns it's path and format
        /// </summary>
        /// <param name="path"></param>
        /// <param name="mountedPath"></param>
        /// <returns></returns>
        private static VideoFormat MountImage(string path, out string mountedPath)
        {
            VideoFormat videoFormat = VideoFormat.UNKNOWN;

            MountingTool mounter = new MountingTool();

            if (mounter.Mount(path, out mountedPath))
            {
                mountedPath += ":\\";

                // now that we've mounted it let's see what it is
                videoFormat = (FileScanner.IsDVD(mountedPath))
                                   ? VideoFormat.DVD
                                   : (FileScanner.IsBluRay(mountedPath))
                                        ? VideoFormat.BLURAY
                                        : (FileScanner.IsHDDVD(mountedPath))
                                            ? VideoFormat.HDDVD
                                            : VideoFormat.UNKNOWN;
            }
            else
            {
                mountedPath = null;
            }

            return(videoFormat);
        }
Exemplo n.º 4
0
        /// <summary>
        /// detecting changes
        /// </summary>
        /// <returns></returns>
        public bool IsDirty()
        {
            if (this.enableSave == true)
            {
                if (OMLSettings.VirtualDiscDrive != virtualDriveOptions.Chosen.ToString().Replace(@":\", ""))
                {
                    return(true);
                }
                MountingTool.Tool tool = MountingTool.Tool.None;

                switch (this.mountingToolChoice.Chosen.ToString())
                {
                case "DAEMON Tools Lite":
                    tool = MountingTool.Tool.DaemonTools;
                    break;

                case "Virtual CloneDrive":
                    tool = MountingTool.Tool.VirtualCloneDrive;
                    break;

                default:
                    tool = MountingTool.Tool.None;
                    break;
                }
                if (OMLSettings.MountingToolSelection != tool)
                {
                    return(true);
                }

                if (OMLSettings.MountingToolPath != MountingTool.GetMountingToolPath(tool))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 5
0
        public ImageMountingSettings()
        {
            this.descriptiveText = "If your library includes DVD images OML can automatically mount them with either DAEMON Tools Lite or SlySoft Virtual CloneDrive.";
            this.commands        = new ArrayListDataSet(this);

            //save command
            Command saveCmd = new Command();

            saveCmd.Description = "Save";
            saveCmd.Invoked    += new EventHandler(saveCmd_Invoked);
            this.commands.Add(saveCmd);

            //cancel command
            Command cancelCmd = new Command();

            cancelCmd.Description = "Cancel";
            cancelCmd.Invoked    += new EventHandler(cancelCmd_Invoked);
            this.commands.Add(cancelCmd);

            //advanced command
            Command advancedCmd = new Command();

            advancedCmd.Description = "Advanced";
            advancedCmd.Invoked    += new EventHandler(advancedCmd_Invoked);
            this.commands.Add(advancedCmd);


            this.mountingToolChoiceEnabled = new BooleanChoice(this);
            this.useAdvancedSettings       = OMLSettings.MountingToolUseAdvanced;


            this.mountingToolChoice = new Choice(this);
            List <string> toolList = new List <string>();

            if (!String.IsNullOrEmpty(MountingTool.GetMountingToolPath(MountingTool.Tool.DaemonTools)))
            {
                toolList.Add("DAEMON Tools Lite");
                this.enableDaemonTools = false;
            }
            else
            {
                //toolList.Add("DAEMON Tools Lite (Not Installed)");
                this.enableDaemonTools = true;
            }

            if (!String.IsNullOrEmpty(MountingTool.GetMountingToolPath(MountingTool.Tool.VirtualCloneDrive)))
            {
                toolList.Add("Virtual CloneDrive");
                this.enableVirtualCloneDrive = false;
            }
            else
            {
                //toolList.Add("Virtual CloneDrive (Not Installed)");
                this.enableVirtualCloneDrive = true;
            }

            if (toolList.Count == 0)
            {
                toolList.Add("None");
            }
            this.mountingToolChoice.Options = toolList;

            this.virtualDriveOptions         = new Choice(this);
            this.virtualDriveOptions.Options = MountingTool.GetAvailableDriveLetters();

            string chosenDrive = string.Format(@"{0}:\", OMLSettings.VirtualDiscDrive);

            if (this.virtualDriveOptions.Options.IndexOf(chosenDrive) > -1)
            {
                this.virtualDriveOptions.Chosen = chosenDrive;
            }
            else
            {
                this.virtualDriveOptions.ChosenIndex = this.virtualDriveOptions.Options.IndexOf(MountingTool.GetFirstFreeDriveLetter());
            }

            MountingTool.Tool selectedTool = (MountingTool.Tool)OMLSettings.MountingToolSelection;


            this.enableImageMounting             = new BooleanChoice(this);
            this.enableImageMounting.Description = "Enable Image Mounting";
            if (selectedTool != MountingTool.Tool.None)
            {
                this.enableImageMounting.Value = true;
            }
            else
            {
                this.enableImageMounting.Value = false;
            }

            if (this.mountingToolChoice.Options[0].ToString() != "None")
            {
                this.mountingToolChoiceEnabled.Value = true;
                switch (selectedTool)
                {
                case MountingTool.Tool.DaemonTools:
                    this.mountingToolChoice.ChosenIndex = 0;
                    break;

                case MountingTool.Tool.VirtualCloneDrive:
                    if (this.mountingToolChoice.Options.Count > 1)
                    {
                        this.mountingToolChoice.ChosenIndex = 1;
                    }
                    else
                    {
                        this.mountingToolChoice.ChosenIndex = 0;
                    }
                    break;
                }
            }
            else
            {
                this.mountingToolChoiceEnabled.Value = false;    //nothing detected
                this.enableSave = false;
                if (this.useAdvancedSettings == true)
                {
                    this.descriptiveText = "OML is currently configured to use advanced options for image mounting. Use \"Advanced\" to modify these settings.";
                }
                else
                {
                    this.descriptiveText = "OML was unable to automatically detect DAEMON Tools Lite or SlySoft Virtual CloneDrive. One of these tools is required for OML to automatically mount DVD images. \n\nPlease refer to the manual for installation instructions or choose \"Advanced\" if you would like to configure image mounting manually.";
                }
            }
        }
Exemplo n.º 6
0
        public ImageMountingSettingsAdvanced()
        {
            this.commands = new ArrayListDataSet(this);

            //save command
            Command saveCmd = new Command();

            saveCmd.Description = "Save";
            saveCmd.Invoked    += new EventHandler(saveCmd_Invoked);
            this.commands.Add(saveCmd);

            //cancel command
            Command cancelCmd = new Command();

            cancelCmd.Description = "Cancel";
            cancelCmd.Invoked    += new EventHandler(cancelCmd_Invoked);
            this.commands.Add(cancelCmd);

            this.mountingToolPath       = new EditableText(this);
            this.mountingToolPath.Value = OMLSettings.MountingToolPath;
            this.mountingToolChoice     = new Choice(this);
            List <string> toolList = new List <string>();

            toolList.Add("DAEMON Tools Lite");
            toolList.Add("Virtual CloneDrive");

            this.mountingToolChoice.Options = toolList;

            this.virtualDriveOptions         = new Choice(this);
            this.virtualDriveOptions.Options = MountingTool.GetAvailableDriveLetters();

            string chosenDrive = string.Format(@"{0}:\", OMLSettings.VirtualDiscDrive);

            if (this.virtualDriveOptions.Options.IndexOf(chosenDrive) > -1)
            {
                this.virtualDriveOptions.Chosen = chosenDrive;
            }
            else
            {
                this.virtualDriveOptions.ChosenIndex = this.virtualDriveOptions.Options.IndexOf(MountingTool.GetFirstFreeDriveLetter());
            }

            MountingTool.Tool selectedTool = (MountingTool.Tool)OMLSettings.MountingToolSelection;


            this.enableImageMounting             = new BooleanChoice(this);
            this.enableImageMounting.Description = "Manually configure image mounting";
            if (selectedTool != MountingTool.Tool.None)
            {
                this.enableImageMounting.Value = true;
            }
            else
            {
                this.enableImageMounting.Value = false;
            }

            switch (selectedTool)
            {
            case MountingTool.Tool.DaemonTools:
                this.mountingToolChoice.ChosenIndex = 0;
                break;

            case MountingTool.Tool.VirtualCloneDrive:
                this.mountingToolChoice.ChosenIndex = 1;
                break;
            }
        }
Exemplo n.º 7
0
        //private const string DefaultDaemonToolsPath = @"Program Files\DAEMON Tools Lite\daemon.exe";
        //private const string DefaultVirtualCloneDrivePath = @"Program Files\Elaborate Bytes\VirtualCloneDrive\VCDMount.exe";
        public void LocateSelectedMounter()
        {
            OMLApplication.Current.IsBusy = true;

            MountingTool mnt = new MountingTool();

            string driveLetterToScan = LocalFixedDrives.Chosen as String;

            MountingTool.Tool tool = (MountingTool.Tool)Enum.Parse(typeof(MountingTool.Tool), _ImageMountingSelection.Chosen.ToString());

            Application.DeferredInvokeOnWorkerThread(delegate
            {
                exePath = mnt.ScanForMountTool(tool, driveLetterToScan);

            }, delegate
            {
                OMLApplication.Current.IsBusy = false;
                if (exePath.Length > 0)
                {
                    OMLApplication.DebugLine("[Settings] Found Image Mounter: {0}", exePath);
                    MountingToolPath.Value = exePath;
                }
                else
                {
                    AddInHost.Current.MediaCenterEnvironment.Dialog(
                        string.Format("The image mounter was not" +
                                      " found on the [{0}] drive.", driveLetterToScan),
                        "Failed to Find Image Mounter",
                        Microsoft.MediaCenter.DialogButtons.Ok,
                        5, true);
                }
            }, null);

            /*
            string driveLetterToScan = LocalFixedDrives.Chosen as String;
            DriveInfo dInfo = new DriveInfo(driveLetterToScan);

            string startPath = null;

            switch ((MountingTool.Tool)Enum.Parse(typeof(MountingTool.Tool), _ImageMountingSelection.Chosen.ToString()))
            {
                case MountingTool.Tool.None:
                    // don't do anything if there's no mounting tool selected
                    return;

                case MountingTool.Tool.DaemonTools:
                    startPath = DefaultDaemonToolsPath;
                    break;

                case  MountingTool.Tool.VirtualCloneDrive:
                    startPath = DefaultVirtualCloneDrivePath;
                    break;

                default:
                    return;
            }

            if (File.Exists(Path.Combine(dInfo.RootDirectory.FullName, startPath)))
            {
                MountingToolPath.Value = Path.Combine(dInfo.RootDirectory.FullName, startPath);
            }
            else
            {
                // let's scan all the folders for it
                OMLApplication.Current.IsBusy = true;
                Application.DeferredInvokeOnWorkerThread(delegate
                {
                    exePath = ScanAllFoldersForExecutable(dInfo.RootDirectory.FullName, Path.GetFileName(startPath));

                }, delegate
                {
                    OMLApplication.Current.IsBusy = false;
                    if (exePath.Length > 0)
                    {
                        OMLApplication.DebugLine("[Settings] Found Image Mounter: {0}", exePath);
                        MountingToolPath.Value = exePath;
                    }
                    else
                    {
                        AddInHost.Current.MediaCenterEnvironment.Dialog(
                            string.Format("The image mounter was not" +
                                          " found on the [{0}] drive.", driveLetterToScan),
                            "Failed to Find Image Mounter",
                            Microsoft.MediaCenter.DialogButtons.Ok,
                            5, true);
                    }
                }, null);
            }*/
        }
Exemplo n.º 8
0
        //private const string DefaultDaemonToolsPath = @"Program Files\DAEMON Tools Lite\daemon.exe";
        //private const string DefaultVirtualCloneDrivePath = @"Program Files\Elaborate Bytes\VirtualCloneDrive\VCDMount.exe";

        public void LocateSelectedMounter()
        {
            OMLApplication.Current.IsBusy = true;

            MountingTool mnt = new MountingTool();

            string driveLetterToScan = LocalFixedDrives.Chosen as String;

            MountingTool.Tool tool = (MountingTool.Tool)Enum.Parse(typeof(MountingTool.Tool), _ImageMountingSelection.Chosen.ToString());

            Application.DeferredInvokeOnWorkerThread(delegate
            {
                exePath = mnt.ScanForMountTool(tool, driveLetterToScan);
            }, delegate
            {
                OMLApplication.Current.IsBusy = false;
                if (exePath.Length > 0)
                {
                    OMLApplication.DebugLine("[Settings] Found Image Mounter: {0}", exePath);
                    MountingToolPath.Value = exePath;
                }
                else
                {
                    AddInHost.Current.MediaCenterEnvironment.Dialog(
                        string.Format("The image mounter was not" +
                                      " found on the [{0}] drive.", driveLetterToScan),
                        "Failed to Find Image Mounter",
                        Microsoft.MediaCenter.DialogButtons.Ok,
                        5, true);
                }
            }, null);


            /*
             * string driveLetterToScan = LocalFixedDrives.Chosen as String;
             * DriveInfo dInfo = new DriveInfo(driveLetterToScan);
             *
             * string startPath = null;
             *
             * switch ((MountingTool.Tool)Enum.Parse(typeof(MountingTool.Tool), _ImageMountingSelection.Chosen.ToString()))
             * {
             *  case MountingTool.Tool.None:
             *      // don't do anything if there's no mounting tool selected
             *      return;
             *
             *  case MountingTool.Tool.DaemonTools:
             *      startPath = DefaultDaemonToolsPath;
             *      break;
             *
             *  case  MountingTool.Tool.VirtualCloneDrive:
             *      startPath = DefaultVirtualCloneDrivePath;
             *      break;
             *
             *  default:
             *      return;
             * }
             *
             * if (File.Exists(Path.Combine(dInfo.RootDirectory.FullName, startPath)))
             * {
             *  MountingToolPath.Value = Path.Combine(dInfo.RootDirectory.FullName, startPath);
             * }
             * else
             * {
             *  // let's scan all the folders for it
             *  OMLApplication.Current.IsBusy = true;
             *  Application.DeferredInvokeOnWorkerThread(delegate
             *  {
             *      exePath = ScanAllFoldersForExecutable(dInfo.RootDirectory.FullName, Path.GetFileName(startPath));
             *
             *  }, delegate
             *  {
             *      OMLApplication.Current.IsBusy = false;
             *      if (exePath.Length > 0)
             *      {
             *          OMLApplication.DebugLine("[Settings] Found Image Mounter: {0}", exePath);
             *          MountingToolPath.Value = exePath;
             *      }
             *      else
             *      {
             *          AddInHost.Current.MediaCenterEnvironment.Dialog(
             *              string.Format("The image mounter was not" +
             *                            " found on the [{0}] drive.", driveLetterToScan),
             *              "Failed to Find Image Mounter",
             *              Microsoft.MediaCenter.DialogButtons.Ok,
             *              5, true);
             *      }
             *  }, null);
             * }*/
        }
Exemplo n.º 9
0
        /// <summary>
        /// Mounts an image and returns it's path and format
        /// </summary>
        /// <param name="path"></param>
        /// <param name="mountedPath"></param>
        /// <returns></returns>
        private static VideoFormat MountImage(string path, out string mountedPath)
        {
            VideoFormat videoFormat = VideoFormat.UNKNOWN;

            MountingTool mounter = new MountingTool();

            if (mounter.Mount(path, out mountedPath))
            {
                mountedPath += ":\\";

                // now that we've mounted it let's see what it is
                videoFormat = (FileScanner.IsDVD(mountedPath))
                                   ? VideoFormat.DVD
                                   : (FileScanner.IsBluRay(mountedPath))
                                        ? VideoFormat.BLURAY
                                        : (FileScanner.IsHDDVD(mountedPath))
                                            ? VideoFormat.HDDVD
                                            : VideoFormat.UNKNOWN;

            }
            else
            {
                mountedPath = null;
            }

            return videoFormat;
        }