Exemplo n.º 1
0
    private ChannelMenuLevel Extract(string[] path, int levelIdx)
    {
        string pathElem = path[levelIdx];

        if (!SubLevels.TryGetValue(pathElem, out ChannelMenuLevel subLevel))
        {
            return(null);
        }

        if (levelIdx == path.Length - 1)
        {
            SubLevels.Remove(pathElem);
            return(subLevel);
        }
        else
        {
            return(subLevel.Extract(path, levelIdx + 1));
        }
    }
Exemplo n.º 2
0
    private void Add(Channel channel, string[] path, int levelIdx)
    {
        while (path[levelIdx].Length == 0 || SkipCategories.Contains(path[levelIdx]))
        {
            levelIdx += 1;
        }

        string pathElem = path[levelIdx];

        if (levelIdx == path.Length - 1)
        {
            Channels[pathElem] = channel;
        }
        else
        {
            if (!SubLevels.TryGetValue(pathElem, out var subLevel))
            {
                subLevel = new ChannelMenuLevel(model);
                SubLevels.Add(pathElem, subLevel);
            }
            subLevel.Add(channel, path, levelIdx + 1);
        }
    }
Exemplo n.º 3
0
 public void AddLevel(string name, Level lvl)
 {
     ConsoleFunctions.WriteDebugLine("Initiating level: " + name);
     SubLevels.Add(name, lvl);
 }