Beispiel #1
0
 private PersistedSettingsDto CurrentSettingsToDto(CurrentSettings settings)
 {
     return(new PersistedSettingsDto
     {
         AudioSource = settings.AudioSource,
         CurrentProfileName = settings.CurrentProfileName,
         Profiles = settings.Profiles,
         AudioSourceSettings = settings.AudioSourceSettings,
     });
 }
Beispiel #2
0
        /// <inheritdoc />
        public void WriteProfiles(IEnumerable <UserProfile> profiles, string path)
        {
            // Just write out the settings object stripped of everything else to make it easier to import/export
            // And as a bonus we can reuse the migrations so we can import older settings.
            var exportObject = new CurrentSettings
            {
                Profiles = profiles.ToList(),
            };

            Toml.WriteFile(exportObject, path, TomlHelper.DefaultSettings);
        }
Beispiel #3
0
 private void SerializeSettings(CurrentSettings settings)
 {
     try
     {
         Toml.WriteFile(settings, SettingsFilePath, TomlHelper.DefaultSettings);
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Beispiel #4
0
        private CurrentSettings CreateDefaultSettingsFile()
        {
            var settings = new CurrentSettings()
            {
                AudioSource         = null,
                AudioSourceSettings = new List <AudioSourceSettings>(),
                Profiles            = new List <UserProfile> {
                    UserProfile.CreateDefaultProfile(UserProfile.DefaultProfileName)
                },
                CurrentProfileName = UserProfile.DefaultProfileName,
            };

            SerializeSettings(settings);
            return(settings);
        }