private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("musicfiles", "extractthumbs", btnExtractthumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "createartistthumbs", btnCreateartistthumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "creategenrethumbs", btnCreategenrethumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "useFolderThumbs", btnUseFolderThumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "useAllImages", btnUseAllImages.Selected); xmlwriter.SetValueAsBool("musicfiles", "createMissingFolderThumbs", btnCreateMissingFolderThumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "treatFolderAsAlbum", btnTreatFolderAsAlbum.Selected); xmlwriter.SetValueAsBool("musicfiles", "monitorShares", btnMonitorShares.Selected); xmlwriter.SetValueAsBool("musicfiles", "updateSinceLastImport", btnUpdateSinceLastImport.Selected); xmlwriter.SetValueAsBool("musicfiles", "stripartistprefixes", btnStripartistprefixes.Selected); xmlwriter.SetValue("musicfiles", "artistprefixes", _prefixes); xmlwriter.SetValue("musicfiles", "dateadded", _dateAddedSelectedIndex); SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); settingsSharesHelper.ShareListControl = lcFolders.ListItems; settingsSharesHelper.RememberLastFolder = _rememberLastFolder; settingsSharesHelper.AddOpticalDiskDrives = _addOpticalDiskDrives; settingsSharesHelper.SwitchRemovableDrives = _autoSwitchRemovableDrives; settingsSharesHelper.DefaultShare = _defaultShare; settingsSharesHelper.SaveSettings("music"); } }
// Set current or new directory information private void Update() { _folderName = FolderInfo(_shareFolderListItem).Name; _folderPath = FolderInfo(_shareFolderListItem).Folder; _folderPin = FolderInfo(_shareFolderListItem).PinCode; _folderCreateThumbs = FolderInfo(_shareFolderListItem).CreateThumbs; _folderEachFolderIsMovie = FolderInfo(_shareFolderListItem).EachFolderIsMovie; _folderDefaultLayout = FolderInfo(_shareFolderListItem).DefaultLayout.ToString(); _folderDefaultLayoutIndex = SettingsSharesHelper.ProperDefaultFromLayout(FolderInfo(_shareFolderListItem).DefaultLayout); }
private void OnResetFolders() { videosShareListcontrol.Clear(); SettingsSharesHelper sh = new SettingsSharesHelper(); sh.SetDefaultDrives(_section, btnAddOpticalDrives.Selected); LoadSettings(); Update(); SetProperties(); }
private void SaveSettings() { SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); settingsSharesHelper.ShareListControl = lcFolders.ListItems; settingsSharesHelper.RememberLastFolder = _rememberLastFolder; settingsSharesHelper.AddOpticalDiskDrives = _addOpticalDiskDrives; settingsSharesHelper.SwitchRemovableDrives = _autoSwitchRemovableDrives; settingsSharesHelper.DefaultShare = _defaultShare; settingsSharesHelper.SaveSettings("pictures"); }
private void SaveSettings() { // Sort by folder name (GUIListItem.label) Sort(); // Toggle buttons SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); settingsSharesHelper.AddOpticalDiskDrives = btnAddOpticalDrives.Selected; settingsSharesHelper.RememberLastFolder = btnRemeberLastFolder.Selected; settingsSharesHelper.SwitchRemovableDrives = btnAutoSwitchRemovables.Selected; settingsSharesHelper.DefaultShare = _defaultShare; settingsSharesHelper.ShareListControl = videosShareListcontrol.ListItems; settingsSharesHelper.SaveSettings(_section); }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { _noLargeThumbnails = xmlreader.GetValueAsBool("thumbnails", "picturenolargethumbondemand", true); lcFolders.Clear(); _scanShare = 0; SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); // Load share settings settingsSharesHelper.LoadSettings("pictures"); foreach (GUIListItem item in settingsSharesHelper.ShareListControl) { string driveLetter = FolderInfo(item).Folder.Substring(0, 3).ToUpperInvariant(); if (driveLetter.StartsWith("\\\\") || Util.Utils.getDriveType(driveLetter) == 3 || Util.Utils.getDriveType(driveLetter) == 4) { item.IsPlayed = false; if (FolderInfo(item).ScanShare) { item.IsPlayed = true; item.Label2 = GUILocalizeStrings.Get(193); // Scan _scanShare++; } item.OnItemSelected += OnItemSelected; item.Label = FolderInfo(item).Folder; item.Path = FolderInfo(item).Folder; lcFolders.Add(item); } } _defaultShare = xmlreader.GetValueAsString("pictures", "default", ""); _rememberLastFolder = xmlreader.GetValueAsBool("pictures", "rememberlastfolder", false); _addOpticalDiskDrives = xmlreader.GetValueAsBool("pictures", "AddOpticalDiskDrives", true); _autoSwitchRemovableDrives = xmlreader.GetValueAsBool("pictures", "SwitchRemovableDrives", true); } }
private void LoadSettings() { videosShareListcontrol.Clear(); SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); // Load share settings settingsSharesHelper.LoadSettings(_section); // ToggleButtons btnAddOpticalDrives.Selected = settingsSharesHelper.AddOpticalDiskDrives; btnRemeberLastFolder.Selected = settingsSharesHelper.RememberLastFolder; btnAutoSwitchRemovables.Selected = settingsSharesHelper.SwitchRemovableDrives; foreach (var item in settingsSharesHelper.ShareListControl) { item.OnItemSelected += OnItemSelected; videosShareListcontrol.Add(item); if (item.IsPlayed) { _defaultShare = FolderInfo(item).Name; } } Sort(); if (videosShareListcontrol.Count > 0) { videosShareListcontrol.SelectedListItemIndex = 0; _shareFolderListItem = videosShareListcontrol.SelectedListItem; _folderDefaultLayoutIndex = SettingsSharesHelper.ProperDefaultFromLayout(FolderInfo(_shareFolderListItem).DefaultLayout); } using (Profile.Settings xmlreader = new MPSettings()) { _globalVideoThumbsEnaled = xmlreader.GetValueAsBool("thumbnails", "videoondemand", true); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { btnExtractthumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "extractthumbs", false); btnCreateartistthumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "createartistthumbs", false); btnCreategenrethumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "creategenrethumbs", true); btnUseFolderThumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "useFolderThumbs", true); btnUseAllImages.Selected = xmlreader.GetValueAsBool("musicfiles", "useAllImages", btnUseFolderThumbs.Selected); btnTreatFolderAsAlbum.Selected = xmlreader.GetValueAsBool("musicfiles", "treatFolderAsAlbum", false); if (btnTreatFolderAsAlbum.Selected) { btnCreateMissingFolderThumbs.IsEnabled = true; } else { btnCreateMissingFolderThumbs.IsEnabled = false; } btnCreateMissingFolderThumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "createMissingFolderThumbs", btnTreatFolderAsAlbum.Selected); btnMonitorShares.Selected = xmlreader.GetValueAsBool("musicfiles", "monitorShares", false); btnUpdateSinceLastImport.Selected = xmlreader.GetValueAsBool("musicfiles", "updateSinceLastImport", true); _updateSinceLastImport = String.Format("Only update files after {0}", xmlreader.GetValueAsString("musicfiles", "lastImport", "1900-01-01 00:00:00")); btnStripartistprefixes.Selected = xmlreader.GetValueAsBool("musicfiles", "stripartistprefixes", false); _prefixes = xmlreader.GetValueAsString("musicfiles", "artistprefixes", "The, Les, Die"); _dateAddedSelectedIndex = xmlreader.GetValueAsInt("musicfiles", "dateadded", 0); lcFolders.Clear(); _scanShare = 0; SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); // Load share settings settingsSharesHelper.LoadSettings("music"); foreach (GUIListItem item in settingsSharesHelper.ShareListControl) { string driveLetter = FolderInfo(item).Folder.Substring(0, 3).ToUpper(); if (driveLetter.StartsWith("\\\\") || Util.Utils.getDriveType(driveLetter) == 3 || Util.Utils.getDriveType(driveLetter) == 4) { item.IsPlayed = false; if (FolderInfo(item).ScanShare) { item.IsPlayed = true; item.Label2 = GUILocalizeStrings.Get(193); _scanShare++; } item.OnItemSelected += OnItemSelected; item.Label = FolderInfo(item).Folder; item.Path = FolderInfo(item).Folder; lcFolders.Add(item); } } _defaultShare = xmlreader.GetValueAsString("music", "default", ""); _rememberLastFolder = xmlreader.GetValueAsBool("music", "rememberlastfolder", false); _addOpticalDiskDrives = xmlreader.GetValueAsBool("music", "AddOpticalDiskDrives", true); _autoSwitchRemovableDrives = xmlreader.GetValueAsBool("music", "SwitchRemovableDrives", true); } }
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { base.OnClicked(controlId, control, actionType); // Default folder (select/deselect on click) - settings saved if (control == videosShareListcontrol) { OnSetDefaultFolder(); } // Add new folder if (control == btnAdd) { // reset menu position _selectedOption = -1; // reset folder browser ClearFolders(); // Clear folder info ClearFolderInfoData(); _userNetFolder = GUILocalizeStrings.Get(145); // Network // Show menu OnAddEditFolder(); // Define new folder GUIListItem item = new GUIListItem(); // Watch for last parameter (my version with selective thumbs will use that) ShareData shareData = new ShareData("", "", "", true); item.AlbumInfoTag = shareData; _shareFolderListItem = item; // Check new data CheckCurrentShareData(); if (_error) { _error = false; GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(257); dlgOk.SetLine(1, GUILocalizeStrings.Get(300053)); // Error in folder data dlgOk.SetLine(2, GUILocalizeStrings.Get(300054)); // Name or path couldn't be empty dlgOk.DoModal(GUIWindowManager.ActiveWindow); return; } // Prepare folder info data FolderInfo(_shareFolderListItem).DefaultLayout = SettingsSharesHelper.ProperLayoutFromDefault(_folderDefaultLayoutIndex); FolderInfo(_shareFolderListItem).Name = _folderName; FolderInfo(_shareFolderListItem).Folder = _folderPath; FolderInfo(_shareFolderListItem).CreateThumbs = _folderCreateThumbs; FolderInfo(_shareFolderListItem).EachFolderIsMovie = _folderEachFolderIsMovie; FolderInfo(_shareFolderListItem).PinCode = _folderPin; // Almost forgot this, needed for proper sort :) _shareFolderListItem.Label = _folderName; _shareFolderListItem.OnItemSelected += OnItemSelected; // Add new folder in list videosShareListcontrol.Add(_shareFolderListItem); GUIListItem newItem = _shareFolderListItem; Sort(); int index = videosShareListcontrol.ListItems.IndexOf(newItem); videosShareListcontrol.SelectedListItemIndex = index; } // Edit folder if (control == btnEdit) { string name = _folderName; string path = _folderPath; // reset menu position _selectedOption = -1; OnAddEditFolder(); // Check new data CheckCurrentShareData(); if (_error) { _error = false; GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(257); dlgOk.SetLine(1, GUILocalizeStrings.Get(300053)); // Error in folder data dlgOk.SetLine(2, GUILocalizeStrings.Get(300054)); // Name or path couldn't be empty dlgOk.DoModal(GUIWindowManager.ActiveWindow); _folderName = name; _folderPath = path; return; } // Update changes FolderInfo(_shareFolderListItem).Name = _folderName; _shareFolderListItem.Label = _folderName; FolderInfo(_shareFolderListItem).Folder = _folderPath; FolderInfo(_shareFolderListItem).PinCode = _folderPin; FolderInfo(_shareFolderListItem).CreateThumbs = _folderCreateThumbs; FolderInfo(_shareFolderListItem).EachFolderIsMovie = _folderEachFolderIsMovie; FolderInfo(_shareFolderListItem).DefaultLayout = SettingsSharesHelper.ProperLayoutFromDefault(_folderDefaultLayoutIndex); // Add changes to a listitem videosShareListcontrol.SelectedListItem.AlbumInfoTag = _shareFolderListItem.AlbumInfoTag; videosShareListcontrol.SelectedListItem.Label = _folderName; // Sort list GUIListItem newItem = _shareFolderListItem; Sort(); int index = videosShareListcontrol.ListItems.IndexOf(newItem); videosShareListcontrol.SelectedListItemIndex = index; } // Remove folder - settings saved if (control == btnRemove) { OnRemoveFolder(); } // Reset folders - settings saved if (control == btnReset) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); if (dlgYesNo != null) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(927)); // Warning dlgYesNo.SetLine(1, GUILocalizeStrings.Get(300055)); // this will delete folders dlgYesNo.DoModal(GetID); if (dlgYesNo.IsConfirmed) { OnResetFolders(); } } } }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("movies", "fuzzyMatching", btnNearestmatch.Selected); // FanArt xmlwriter.SetValueAsBool("moviedatabase", "usefanart", btnUsefanart.Selected); xmlwriter.SetValue("moviedatabase", "fanartnumber", m_iCount); // Folder movie title xmlwriter.SetValueAsBool("moviedatabase", "usefolderastitle", btnFoldernamefortitle.Selected); xmlwriter.SetValueAsBool("moviedatabase", "preferfilenameforsearch", btnPrefervideofilename.Selected); // Strip movie title prefix xmlwriter.SetValueAsBool("moviedatabase", "striptitleprefixes", btnStripprefix.Selected); xmlwriter.SetValue("moviedatabase", "titleprefixes", _prefixes); // Database xmlwriter.SetValueAsBool("moviedatabase", "scanskipexisting", btnSkipalreadyexisting.Selected); // Actors fetch size xmlwriter.SetValue("moviedatabase", "actorslistsize", _actorsFetchSize); // SortTitle xmlwriter.SetValueAsBool("moviedatabase", "usesorttitle", btnUseSortTitle.Selected); // nfo scraper only xmlwriter.SetValueAsBool("moviedatabase", "useonlynfoscraper", btnUseNfoScraper.Selected); SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); settingsSharesHelper.ShareListControl = lcFolders.ListItems; settingsSharesHelper.RememberLastFolder = _rememberLastFolder; settingsSharesHelper.AddOpticalDiskDrives = _addOpticalDiskDrives; settingsSharesHelper.SwitchRemovableDrives = _autoSwitchRemovableDrives; settingsSharesHelper.DefaultShare = _defaultShare; settingsSharesHelper.SaveSettings("movies"); } }
// Need change for 1.3.0 #region Serialization private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { // Automatch btnNearestmatch.Selected = xmlreader.GetValueAsBool("movies", "fuzzyMatching", true); string configDir; FanArt.GetFanArtFolder(out configDir); if (Directory.Exists(configDir)) { // FanArt setting btnUsefanart.Selected = xmlreader.GetValueAsBool("moviedatabase", "usefanart", false); if (btnUsefanart.Selected) { GUIControl.EnableControl(GetID, (int)Controls.CONTROL_FANARTCOUNT); } else { GUIControl.DisableControl(GetID, (int)Controls.CONTROL_FANARTCOUNT); } } else { btnUsefanart.IsEnabled = false; btnUsefanart.Selected = false; GUIControl.DisableControl(GetID, (int)Controls.CONTROL_FANARTCOUNT); } int faCount = xmlreader.GetValueAsInt("moviedatabase", "fanartnumber", 1); if (faCount < 1) { m_iCount = 1; } else { m_iCount = faCount; } _actorsFetchSize = xmlreader.GetValueAsString("moviedatabase", "actorslistsize", "Short"); // Folder names as title btnFoldernamefortitle.Selected = xmlreader.GetValueAsBool("moviedatabase", "usefolderastitle", false); if (btnFoldernamefortitle.Selected) { btnPrefervideofilename.IsEnabled = true; } else { btnPrefervideofilename.IsEnabled = false; } btnPrefervideofilename.Selected= xmlreader.GetValueAsBool("moviedatabase", "preferfilenameforsearch", false); // Skip existing btnSkipalreadyexisting.Selected = xmlreader.GetValueAsBool("moviedatabase", "scanskipexisting", true); // Prefixes btnStripprefix.Selected = xmlreader.GetValueAsBool("moviedatabase", "striptitleprefixes", false); _prefixes = xmlreader.GetValueAsString("moviedatabase", "titleprefixes", "The, Les, Die"); // Load share settings lcFolders.Clear(); _scanShare = 0; SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); settingsSharesHelper.LoadSettings("movies"); foreach (GUIListItem item in settingsSharesHelper.ShareListControl) { string driveLetter = FolderInfo(item).Folder.Substring(0, 3).ToUpperInvariant(); if (driveLetter.StartsWith("\\\\") || Util.Utils.getDriveType(driveLetter) == 3 || Util.Utils.getDriveType(driveLetter) == 4) { item.IsPlayed = false; if (FolderInfo(item).ScanShare) { item.IsPlayed = true; item.Label2 = GUILocalizeStrings.Get(193); _scanShare++; } item.OnItemSelected += OnItemSelected; item.Label = FolderInfo(item).Folder; item.Path = FolderInfo(item).Folder; lcFolders.Add(item); } } _defaultShare = xmlreader.GetValueAsString("movies", "default", ""); _rememberLastFolder = xmlreader.GetValueAsBool("movies", "rememberlastfolder", false); _addOpticalDiskDrives = xmlreader.GetValueAsBool("movies", "AddOpticalDiskDrives", true); _autoSwitchRemovableDrives = xmlreader.GetValueAsBool("movies", "SwitchRemovableDrives", true); btnUseSortTitle.Selected = xmlreader.GetValueAsBool("moviedatabase", "usesorttitle", false); btnUseNfoScraper.Selected = xmlreader.GetValueAsBool("moviedatabase", "useonlynfoscraper", false); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { btnExtractthumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "extractthumbs", true); btnCreateartistthumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "createartistthumbs", false); btnCreategenrethumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "creategenrethumbs", true); btnUseFolderThumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "useFolderThumbs", false); btnUseAllImages.Selected = xmlreader.GetValueAsBool("musicfiles", "useAllImages", btnUseFolderThumbs.Selected); btnTreatFolderAsAlbum.Selected = xmlreader.GetValueAsBool("musicfiles", "treatFolderAsAlbum", false); if (btnTreatFolderAsAlbum.Selected) { btnCreateMissingFolderThumbs.IsEnabled = true; } else { btnCreateMissingFolderThumbs.IsEnabled = false; } btnCreateMissingFolderThumbs.Selected = xmlreader.GetValueAsBool("musicfiles", "createMissingFolderThumbs", btnTreatFolderAsAlbum.Selected); btnMonitorShares.Selected = xmlreader.GetValueAsBool("musicfiles", "monitorShares", false); btnUpdateSinceLastImport.Selected = xmlreader.GetValueAsBool("musicfiles", "updateSinceLastImport", true); _updateSinceLastImport = String.Format("Only update files after {0}", xmlreader.GetValueAsString("musicfiles", "lastImport", "1900-01-01 00:00:00")); btnStripartistprefixes.Selected = xmlreader.GetValueAsBool("musicfiles", "stripartistprefixes", false); _prefixes = xmlreader.GetValueAsString("musicfiles", "artistprefixes", "The, Les, Die"); _dateAddedSelectedIndex = xmlreader.GetValueAsInt("musicfiles", "dateadded", 0); lcFolders.Clear(); _scanShare = 0; SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); // Load share settings settingsSharesHelper.LoadSettings("music"); foreach (GUIListItem item in settingsSharesHelper.ShareListControl) { string driveLetter = FolderInfo(item).Folder.Substring(0, 3).ToUpper(); if (driveLetter.StartsWith("\\\\") || Util.Utils.getDriveType(driveLetter) == 3 || Util.Utils.getDriveType(driveLetter) == 4) { item.IsPlayed = false; if (FolderInfo(item).ScanShare) { item.IsPlayed = true; item.Label2 = GUILocalizeStrings.Get(193); _scanShare++; } item.OnItemSelected += OnItemSelected; item.Label = FolderInfo(item).Folder; item.Path = FolderInfo(item).Folder; lcFolders.Add(item); } } _defaultShare = xmlreader.GetValueAsString("music", "default", ""); _rememberLastFolder = xmlreader.GetValueAsBool("music", "rememberlastfolder", false); _addOpticalDiskDrives = xmlreader.GetValueAsBool("music", "AddOpticalDiskDrives", true); _autoSwitchRemovableDrives = xmlreader.GetValueAsBool("music", "SwitchRemovableDrives", true); } }