private static Settings LoadSetttings() { var settings = new Settings(); try { var filename = Path.Combine(ApplicationHelper.GetUserDataPath(), "Halloumi.Shuffler.Settings.xml"); if (File.Exists(filename)) { settings = SerializationHelper<Settings>.FromXmlFile(filename); } } catch { } return settings; }
/// <summary> /// Saves the settings. /// </summary> public void SaveSettings() { var settings = new Settings { TxtSearchText = txtSearch.Text, TxtMinBpmText = txtMinBPM.Text, TxtMaxBpmText = txtMaxBPM.Text, CmbTrackRankFilterSelectedIndex = cmbTrackRankFilter.SelectedIndex, CmbShufflerFilterSelectedIndex = cmbShufflerFilter.SelectedIndex, CmbQueuedSelectedIndex = cmbQueued.SelectedIndex, SortColumnName = grdTracks.SortedColumn != null ? grdTracks.SortedColumn.DataPropertyName : "", SortOrder = grdTracks.SortOrder, Playlist = "" }; if (cmbPlaylist.SelectedIndex > 0) { settings.Playlist = cmbPlaylist.SelectedItem.ToString(); } settings.ExcludedPlaylist = ""; if (cmbExcludedPlaylist.SelectedIndex > 0) { settings.ExcludedPlaylist = cmbExcludedPlaylist.SelectedItem.ToString(); } var filename = Path.Combine(Path.GetTempPath(), "Halloumi.Shuffler.Library.xml"); SerializationHelper<Settings>.ToXmlFile(settings, filename); }
/// <summary> /// Saves the settings. /// </summary> private void SaveSettings() { var settings = new Settings { CmbDirectionSelectedIndex = cmbDirection.SelectedIndex, CmbAllowBearableSelectedIndex = cmbAllowBearable.SelectedIndex, CmbApproxLengthSelectedIndex = cmbApproxLength.SelectedIndex, CmbModeSelectedIndex = cmbMode.SelectedIndex, TxtExcludeTracksText = txtExcludeTracks.Text, CmbExtendedMixesSelectedIndex = cmbExtendedMixes.SelectedIndex, ChkExlcudeMixesOnlyChecked = chkExlcudeMixesOnly.Checked, ChkRestrictArtistClumpingChecked = chkRestrictArtistClumping.Checked, ChkRestrictGenreClumpingChecked = chkRestrictGenreClumping.Checked, ChkRestrictTitleClumpingChecked = chkRestrictTitleClumping.Checked, ChkDisplayedTracksOnlyChecked = chkDisplayedTracksOnly.Checked, CmbTracksToGenerateSelectedIndex = cmbTracksToGenerate.SelectedIndex, CmbContinueMixSelectedIndex = cmbContinueMix.SelectedIndex, CmbKeyMixingSelectedIndex = cmbKeyMixing.SelectedIndex }; var filename = Path.Combine(Path.GetTempPath(), "Halloumi.Shuffler.frmGeneratePlaylist.xml"); SerializationHelper<Settings>.ToXmlFile(settings, filename); }
private static Settings GetSettings() { var settings = new Settings(); var filename = Path.Combine(Path.GetTempPath(), "Halloumi.Shuffler.frmGeneratePlaylist.xml"); if (File.Exists(filename)) { settings = SerializationHelper<Settings>.FromXmlFile(filename); } return settings; }