aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Configuration/ConfigurationController.cs
blob: 547d195f5a86b6a576837ddc23b7f85e9ba6f6f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using MediaBrowser.Common.Json;

namespace MediaBrowser.Common.Configuration
{
    public class ConfigurationController<TConfigurationType>
        where TConfigurationType : BaseConfiguration, new ()
    {
        /// <summary>
        /// The path to the configuration file
        /// </summary>
        public string Path { get; set; }

        public TConfigurationType Configuration { get; set; }

        public void Reload()
        {
            if (!File.Exists(Path))
            {
                Configuration = new TConfigurationType();
            }
            else
            {
                Configuration = JsonSerializer.DeserializeFromFile<TConfigurationType>(Path);
            }
        }

        public void Save()
        {
        }
    }
}