changes
This commit is contained in:
@@ -15,17 +15,11 @@ namespace VDownload.Services.Data.Settings
|
||||
[JsonProperty("max_number_of_videos_to_get_from_playlist")]
|
||||
public int MaxNumberOfVideosToGetFromPlaylist { get; set; } = 0;
|
||||
|
||||
[JsonProperty("max_number_of_running_tasks")]
|
||||
public int MaxNumberOfRunningTasks { get; set; } = 5;
|
||||
[JsonProperty("temp")]
|
||||
public Temp Temp { get; set; } = new Temp();
|
||||
|
||||
[JsonProperty("temp_directory")]
|
||||
public string TempDirectory { get; set; } = $"{Path.GetTempPath()}\\VDownload";
|
||||
|
||||
[JsonProperty("delete_temp_on_error")]
|
||||
public bool DeleteTempOnError { get; set; } = true;
|
||||
|
||||
[JsonProperty("default_task_settings")]
|
||||
public DefaultTaskSettings DefaultTaskSettings { get; set; } = new DefaultTaskSettings();
|
||||
[JsonProperty("tasks")]
|
||||
public Tasks Tasks { get; set; } = new Tasks();
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
public Notifications Notifications { get; set; } = new Notifications();
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VDownload.Models;
|
||||
|
||||
namespace VDownload.Services.Data.Settings.Models
|
||||
{
|
||||
public class DefaultTaskSettings
|
||||
{
|
||||
[JsonProperty("media_type")]
|
||||
public MediaType MediaType { get; set; } = MediaType.Original;
|
||||
|
||||
[JsonProperty("video_extension")]
|
||||
public VideoExtension VideoExtension { get; set; } = VideoExtension.MP4;
|
||||
|
||||
[JsonProperty("audio_extension")]
|
||||
public AudioExtension AudioExtension { get; set; } = AudioExtension.MP3;
|
||||
|
||||
[JsonProperty("output_directory")]
|
||||
public string OutputDirectory { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
|
||||
[JsonProperty("save_last_output_directory")]
|
||||
public bool SaveLastOutputDirectory { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VDownload.Models;
|
||||
|
||||
namespace VDownload.Services.Data.Settings.Models
|
||||
{
|
||||
public class Tasks
|
||||
{
|
||||
[JsonProperty("default_media_type")]
|
||||
public MediaType DefaultMediaType { get; set; } = MediaType.Original;
|
||||
|
||||
[JsonProperty("default_video_extension")]
|
||||
public VideoExtension DefaultVideoExtension { get; set; } = VideoExtension.MP4;
|
||||
|
||||
[JsonProperty("default_audio_extension")]
|
||||
public AudioExtension DefaultAudioExtension { get; set; } = AudioExtension.MP3;
|
||||
|
||||
[JsonProperty("default_output_directory")]
|
||||
public string DefaultOutputDirectory { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
|
||||
[JsonProperty("save_last_output_directory")]
|
||||
public bool SaveLastOutputDirectory { get; set; } = false;
|
||||
|
||||
[JsonProperty("max_number_of_running_tasks")]
|
||||
public int MaxNumberOfRunningTasks { get; set; } = 5;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Services.Data.Settings.Models
|
||||
{
|
||||
public class Temp
|
||||
{
|
||||
[JsonProperty("directory")]
|
||||
public string Directory { get; set; } = $"{Path.GetTempPath()}\\VDownload";
|
||||
|
||||
[JsonProperty("delete_on_error")]
|
||||
public bool DeleteOnError { get; set; } = true;
|
||||
}
|
||||
}
|
||||
@@ -75,15 +75,15 @@ namespace VDownload.Services.Data.Settings
|
||||
|
||||
public async Task Load()
|
||||
{
|
||||
Data = null;
|
||||
|
||||
if (File.Exists(_filePath))
|
||||
{
|
||||
string content = await File.ReadAllTextAsync(_filePath);
|
||||
Data = JsonConvert.DeserializeObject<SettingsData>(content);
|
||||
}
|
||||
|
||||
Data ??= new SettingsData();
|
||||
else
|
||||
{
|
||||
Data = new SettingsData();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Save()
|
||||
|
||||
Reference in New Issue
Block a user