1.0-dev6 (Option bar added and code cleaned)
This commit is contained in:
70
VDownload.Core/Services/Config.cs
Normal file
70
VDownload.Core/Services/Config.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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<string, object> DefaultSettings = new Dictionary<string, object>()
|
||||
{
|
||||
{ "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 },
|
||||
};
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user