aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Program/Program.cs
blob: 1933ad1260cc07fca706a807f3662aa9fb836351 (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
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Configuration;
using System.IO;
using MediaBrowser.Controller;

namespace MediaBrowser.Program
{
    class Program
    {
        static void Main(string[] args)
        {
            LoadKernel();
        }

        private static void LoadKernel()
        {
            DateTime now = DateTime.Now;

            Console.WriteLine("Loading");

            string installDir = ConfigurationManager.AppSettings["DataPath"];

            if (!Path.IsPathRooted(installDir))
            {
                string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
                path = Path.GetDirectoryName(path);

                installDir = Path.Combine(path, installDir);

                installDir = Path.GetFullPath(installDir);
            }

            if (!Directory.Exists(installDir))
            {
                Directory.CreateDirectory(installDir);
            }

            Kernel kernel = new Kernel(installDir);

            kernel.Init();

            var time = DateTime.Now - now;
            Console.WriteLine("Done in " + time.TotalSeconds + " seconds");
            
            Console.WriteLine("Press Enter to quit.");
            Console.ReadLine();
        }
    }
}