ICSFormat: check keys using a tree instead of list

When checking for valid keys, individual Strings were checked one at a
time against one master list of words that were present in keys.

Aside from being inefficient, this prevented values from containing
phrases that are also present in keys. In particular, the timestamp
metadata contains "t" in part of its key, which clashed with the
Lifetime hack for Gray institute ICS files.

ICS metadata is organized in a tree hierarchy of categories, so that is
how keys are now checked for validity.

Also, all keys are now pushed to lowercase to avert any potential
problems.

Known limitation: there were some keys of arbitrary length.. not sure of
a good way to support that using a tree structure for key checking,
without some wildcard (which then would match the values erroneously).

You could mark the position where the wildcard was first used, and if
the entire key is consumed then return to that position to build the
value. But I'm not sure that's completely correct.