aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Console/ConsoleDictionary.cs
blob: 00e4a865d3e111f49afc970e5a6a6610e61fb22b (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.Helpers;

namespace Tango.Console
{
    public static class ConsoleDictionary
    {
        private static List<ConsoleKnownCommand> _knownCommands;

        public static List<ConsoleKnownCommand> GetKnownCommands()
        {
            if (_knownCommands == null)
            {
                _knownCommands = new List<ConsoleKnownCommand>();

                String text = EmbeddedResourceHelper.GetEmbeddedResourceText("Tango.Console.CMD.txt");

                foreach (var line in text.ToLines())
                {
                    if (line.IsNotNullOrEmpty())
                    {
                        ConsoleKnownCommand command = new ConsoleKnownCommand();
                        String[] args = line.Split('\t');
                        command.Name = args[0].ToLower();
                        command.Description = args[1].Replace("\"", "");
                        _knownCommands.Add(command);
                    }
                }
            }

            return _knownCommands;
        }
    }
}