Exemplo n.º 1
0
    static Rule ReadContextMenu(RuleFileReader reader)
    {
        var item        = reader.Read();
        var name        = reader.Read();
        var description = reader.Read();
        var directive   = reader.Read();

        IList <string> folders;

        if (directive == ":SEARCH")
        {
            var folder = reader.Read();
            var root   = Path.Combine("HKEY_CLASSES_ROOT", folder);

            folders = RegHelper.Search(root, item)
                      .Select(name => Path.Combine(folder, name))
                      .ToList();
        }
        else
        {
            folders = reader.Drain().ToList();
            folders.Add(directive);
        }

        return(new ContextMenuRule(item, folders, name, description));
    }
Exemplo n.º 2
0
    public void Drain()
    {
        var text   = "我\n好\n他\n妈\n帅\n\n(误)";
        var reader = new RuleFileReader(text);

        var value = string.Join("", reader.Drain());

        Assert.AreEqual("我好他妈帅", value);
    }