Add metadata block to replays

The replay files are just streams all network communication so to
get any info out of them it is necessary to play back the stream
until the wanted information is reached.

This introduces a new metadata block placed at the end of the
replay files and logic to read the new block, or fall back to
playing back the stream for older files.

The replay browser is also updated to use the metadata information
instead of reading the replay stream directly.
Add filters to the replay browser dialog

This closes issue #2152. The filters added are:

* Game type (singleplayer / multiplayer)
* Date
* Duration
* Outcome
* Player name

Other changes:

* Added a 'CollapseHiddenChildren' option to the ScrollPanelWidget to
make hidden children take up no space.
* Removed the extension (.rep) from the replay filenames in the
replay browser.
Style & nit fixes
Support for input validation on TextFieldWidgets

See OnTextEdited(), IsValid(), TextColorInvalid (with the default in metrics.yaml).
New common dialog: TextInputPrompt to get a string from the user

For both ra and cnc
Improve replay metadata and the replay browser

List of changes:

* Better and more filters with new layout, for both mods.

* Rename/Delete/Detele all functionality.

* Simplified ReplayMetadata class considerably by introducing a new
GameInformation data object. The new GameInformation class contains
more information than previously available so the new solution is not
compatible with old replays, meaning it can't read old replays.

* Better and cleaner game information gathering in order to be written
at the end of the replay file.

* Revert changes to ReplayConnection, no longer necessary.

* Better exception message on missing sprites and fonts.

* New "SpawnOccupant" class that holds all the information needed by the
MapPreviewWidget to visualize a spawn point. It was using Session.Client
before and it was necessary to separate it to be able to show information
not available at lobby time.

* Fix keyboard focus UI bug when closing a window would not remove focus.
Change date labels

Change "Last Week" to "Last 7 days" and "Last Month" to "Last 30 days".
Also added a "Last 14 days" option.
Fix crash when trying to read empty replay files

It was crashing because it tried to seek 8 bytes before the end
of a file that was empty (zero length).

I also added a few more checks and another try/catch to prevent
any more crashes related to damaged files.
Use "debug" channel to report loading exceptions
Use the stream extensions instead of the BinaryReader/Writer
Misc changes

* Use Pair instead of KeyValuePair
* double -> var
* Butcher XML comments
* Change WinState default to Undefined and use it instead of the new GameOutcome
* Other changes
Merge pull request #5215 from pavlos256/replay-meta

Replay meta
Changed HardwarePalette.ApplyModifiers to be more efficient.

It will no longer copy the dictionaries or palettes every time, saving significantly on allocations.
Non modifiable palettes are copied to the buffer when they are added, rather than having to be done repeatadly in ApplyModifiers.
The palettesModified flag tracks if the current texture represents unmodified palettes. If it does and no modifications are made then it doesn't have to update the texture at all and can bail early. This is often the case because the paletteMods sequence is usually empty.