aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/StartupOptions.cs
blob: 2212636344404e9d4e4442249126e072b72f6c3a (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
using System;
using System.Linq;

namespace Emby.Server.Implementations
{
    public class StartupOptions
    {
        private readonly string[] _options;

        public StartupOptions(string[] commandLineArgs)
        {
            _options = commandLineArgs;
        }

        public bool ContainsOption(string option)
            => _options.Contains(option, StringComparer.OrdinalIgnoreCase);

        public string GetOption(string name)
        {
            int index = Array.IndexOf(_options, name);

            if (index == -1)
            {
                return null;
            }

            return _options.ElementAtOrDefault(index + 1);
        }
    }
}