using System; using System.Collections.Generic; using VDownload.Core.Enums; using Windows.Media.Editing; using Windows.Storage; namespace VDownload.Core.Services { public class Config { #region CONSTANTS // SETTINGS CONTAINER private static readonly ApplicationDataContainer SettingsContainer = ApplicationData.Current.LocalSettings; // DEFAULT SETTINGS private static readonly Dictionary DefaultSettings = new Dictionary() { { "delete_temp_on_start", true }, { "twitch_vod_passive_trim", true }, { "twitch_vod_downloading_chunk_retry_after_error", true }, { "twitch_vod_downloading_chunk_max_retries", 10 }, { "twitch_vod_downloading_chunk_retries_delay", 5000 }, { "media_transcoding_use_hardware_acceleration", true }, { "media_transcoding_use_mrfcrf444_algorithm", true }, { "media_editing_algorithm", (int)MediaTrimmingPreference.Fast }, { "default_max_playlist_videos", 0 }, { "default_media_type", (int)MediaType.AudioVideo }, { "default_filename", "[] " }, { "default_video_extension", (int)VideoFileExtension.MP4 }, { "default_audio_extension", (int)AudioFileExtension.MP3 }, { "default_location_type", (int)DefaultLocationType.Last }, }; #endregion #region METHODS // GET VALUE public static object GetValue(string key) { return SettingsContainer.Values[key]; } // SET VALUE public static void SetValue(string key, object value) { SettingsContainer.Values[key] = value; } // SET DEFAULT public static void SetDefault() { foreach (KeyValuePair<string, object> s in DefaultSettings) { SettingsContainer.Values[s.Key] = s.Value; } } // REBUILD public static void Rebuild() { foreach (KeyValuePair<string, object> s in DefaultSettings) { if (!SettingsContainer.Values.ContainsKey(s.Key)) { SettingsContainer.Values[s.Key] = s.Value; } } } #endregion } }