Example #1
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(@":\", "");
            }
        }
Example #2
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;
            }
        }
Example #3
0
        /// <summary>
        /// detecting changes
        /// </summary>
        /// <returns></returns>
        public bool IsDirty()
        {
            if (this.EnableImageMounting.Value != OMLSettings.MountingToolUseAdvanced)
            {
                if (OMLSettings.VirtualDiscDrive != virtualDriveOptions.Chosen.ToString().Replace(@":\", ""))
                {
                    return(true);
                }
            }
            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;
            }

            if (OMLSettings.MountingToolSelection != tool)
            {
                return(true);
            }
            if (OMLSettings.MountingToolPath != this.mountingToolPath.Value)
            {
                return(true);
            }

            return(false);
        }
Example #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);
        }
Example #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.";
                }
            }
        }
Example #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;
            }
        }
Example #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);
             * }*/
        }
Example #8
0
        private void SimpleButtonClick(object sender, EventArgs e)
        {
            if (sender == this.sbOK)
            {
                Boolean bDirty = false;
                String  skin   = (String)this.lbcSkins.SelectedValue;
                if (skin != OMLSettings.DBEditorSkin)
                {
                    bDirty = true;
                    OMLSettings.DBEditorSkin = skin;
                }
                if (OMLSettings.UseMPAAList != this.ceUseMPAAList.Checked)
                {
                    bDirty = true;
                    OMLSettings.UseMPAAList = this.ceUseMPAAList.Checked;
                }
                if (MPAAdirty)
                {
                    bDirty = true;
                    String MPAAs = String.Join("|", MPAAList.ToArray());
                    OMLEngine.Settings.OMLSettings.MPAARatings = MPAAs;
                }
                if (OMLSettings.UseGenreList != this.ceUseGenreList.Checked)
                {
                    bDirty = true;
                    OMLSettings.UseGenreList = this.ceUseGenreList.Checked;
                }
                if (TagsDirty)
                {
                    bDirty = true;
                    String Tags = String.Join("|", TagList.ToArray());
                    OMLSettings.Tags = Tags;
                }

                // TODO - needs tidying, do not save on evert OMLEngine change, might need to add another dirty flag
                if (OMLSettings.TitledFanArtFolder != this.ceTitledFanArtFolder.Checked)
                {
                    bDirty = true;
                    OMLSettings.TitledFanArtFolder = this.ceTitledFanArtFolder.Checked;
                }

                if (OMLSettings.TitledFanArtFolder &&
                    OMLSettings.TitledFanArtPath != (string)beTitledFanArtPath.EditValue)
                {
                    bDirty = true;
                    OMLSettings.TitledFanArtPath = (string)this.beTitledFanArtPath.EditValue;
                }

                bDirty = true;

                // Preferred metadata lookup
                OMLEngine.Settings.OMLSettings.DefaultMetadataPluginMovies = (string)cmbDefaultMetadataPlugin.SelectedItem;
                OMLEngine.Settings.OMLSettings.DefaultMetadataPluginTV     = (string)cmbDefaultMetadataPluginTV.SelectedItem;
                OMLEngine.Settings.OMLSettings.MetadataLookupOverwriteExistingDataPrefMovies = !ceUpdateMissingDataOnlyMovies.Checked;
                OMLEngine.Settings.OMLSettings.MetadataLookupUpdateNamePrefMovies            = ceUpdateTitleNameMovies.Checked;
                OMLEngine.Settings.OMLSettings.MetadataLookupOverwriteExistingDataPrefTV     = !ceUpdateMissingDataOnlyTV.Checked;
                OMLEngine.Settings.OMLSettings.MetadataLookupUpdateNamePrefTV = ceUpdateTitleNameTV.Checked;

                OMLEngine.Settings.OMLSettings.MetadataLookupResultsQty   = (int)seMetadataLookupResultsQty.Value;
                OMLEngine.Settings.OMLSettings.MetadataLookupMaxFanartQty = (int)seMetadataLookupMaxFanartQty.Value;

                OMLSettings.StSanaCreateTLFolder                    = ceStSanaCreateTLFolder.Checked;
                OMLSettings.StSanaAlwaysCreateMovieFolder           = ceStSanaAlwaysCreateMovieFolder.Checked;
                OMLEngine.Settings.OMLSettings.StSanaAutoLookupMeta = ceDBEStSanaAutoLookupMeta.Checked;

                if (bDirty)
                {
                    OptionsDirty = bDirty;
                    Properties.Settings.Default.Save();
                }
                if (OMLSettings.TreatFoldersAsTitles != this.ceFoldersAsTitles.Checked)
                {
                    OMLSettings.TreatFoldersAsTitles = this.ceFoldersAsTitles.Checked;
                }
                if (OMLSettings.AddParentFoldersToTitleName != this.cePrependParentFolder.Checked)
                {
                    OMLSettings.AddParentFoldersToTitleName = this.cePrependParentFolder.Checked;
                }

                // Watched folders
                if (WatchedFoldersDirty)
                {
                    IList <OMLSettings.WatchedFolder> SWF = new List <OMLSettings.WatchedFolder>();

                    foreach (ListViewItem lvi in lvWatchedFolders.Items)
                    {
                        OMLSettings.WatchedFolder WF = new OMLSettings.WatchedFolder();
                        WF.Folder = lvi.Text;
                        if (lvi.Tag != null)
                        {
                            WF.ParentID = (int)lvi.Tag;
                        }
                        SWF.Add(WF);
                    }
                    OMLEngine.Settings.OMLSettings.ScannerWatchedFolders        = SWF;
                    OMLEngine.Settings.OMLSettings.ScannerEnabled               = ceFileWatcherEnabled.Checked;
                    OMLEngine.Settings.OMLSettings.ScannerSettingsTagTitlesWith = cmbFileWatchedTag.Text;
                    OMLEngine.Settings.OMLSettings.ScannerSettingsLastUpdated   = DateTime.Now;
                }

                MountingTool.Tool tool = (MountingTool.Tool)Enum.Parse(typeof(MountingTool.Tool), rgMountingTool.Text);
                OMLSettings.MountingToolSelection = tool;
                OMLSettings.VirtualDiscDrive      = cmbMntToolVDrive.Text;
                OMLSettings.MountingToolPath      = teMntToolPath.Text;
            }
            else if (sender == this.sbCancel)
            {
                String skin = OMLEngine.Settings.OMLSettings.DBEditorSkin;
                ((MainEditor)this.Owner).defaultLookAndFeel1.LookAndFeel.SkinName = skin;
            }
            this.Close();
        }