Further improved server-side mod control

This set of commits improves the server-side mod control upgrade documented in Pull Request https://github.com/TehGimp/KerbalMultiPlayer/pull/591. It adds filestream close/dispose on the client hashing, and adds functionality for non-SHA checked required/optional files. I have updated the README with all the relevant details, so for simplicity I will just copy that here:


>
KMP allows server-side mod control (although many mods that change parts of the universe, like Kethane, still do not work). Add mods to your server at your own risk. The old (prior to v0.1.5.0) system, which uses the KMPModControl.txt file on the client's installation, is no longer in effect. Instead, server admins configure their servers' KMPModControl.txt file to their specifications, and clients that do not meet the mod requirements will not be allowed to connect.
>
The simplest way for an admin to configure mods is to use the "Mods/Required", "Mods/Required_Exact", "Mods/Optional", and "Mods/Optional_Exact" directories in their KMP Server directory. Simply copy any mods that you would like to use to the respective directories: mods that you place in the "Mods/Required" or "Mods/Required_Exact" directories will be mandatory for the client to have in order to connect, and mods that you place in the "Mods/Optional" or "Mods/Optional_Exact" directories will be allowed, but not necessary. The "Exact" variants are for mods where you want to force the client to have exactly the same file (does a SHA hash check, so use this if you want to force a specific version of a mod or make sure that certain files weren't modified by the client), and the non-Exact variants are for mods where you just want to make sure they have the right filenames installed (use this if you want to force the client to have a mod, but it doesn't have to match the server's file exactly, so the client could use a newer or older version of the mod). Mods that include parts (e.g. KWRocketry) or that change persistent data about the universe (e.g. RealSolarSystem) should be placed in a "Required" directory, in order to maintain synchronization with other players. Mods that only affect the client (e.g. EditorExtensions) can be placed in an "Optional" directory, so clients can use them if they want to.
>
The server's "checkAllModFiles" setting determines which mod files are checked. If this is set to false (default), it will only check ".cfg" and ".dll" files. If it's set to true, it will check every file in any of the "Mods/" directories.
>
Once you've configured your mods in the "Required" and "Optional" directories as you see fit, run the server program and use the "/modgen" command. This will automatically create a KMPModControl.txt file that matches the file structure you created in the Mods directories. You can now use the "resource-whitelist" section to specify files that are allowed, but DON'T need to exist or be SHA checked. This is useful for adding files that are changed on the client side by the mod itself (like KMP's "KMPPlayerToken.txt" file), which may or may not exist and will not match a SHA hash check. The effects of placing a filename in the whitelist would be the same as putting that file in the "Optional" directory and running /modgen, but this allows you to keep that mod together and not have to split it among different directories (e.g. putting most of KMP in the "Required_Exact" directory, but the "KMPPlayerToken.txt" file in the "Optional" directory). By default, the client can only connect if:
- they have ALL the files in both of the "Required" directories
- their copies of files match the ones on the server in the "Required_Exact" directory (using a SHA256 hash check)
- if they have a file that's in the "Optional_Exact" directory, it must match the one on the server (also using SHA256)
- if they have a file that's in neither the "Required" nor "Optional" directories, they are not allowed to connect
>
Example:
I would like to use KWRocketry parts on my server, and I'm OK with my clients using EditorExtensions but I don't want to force them to (but if they want to, it should be the same version that I put on my server). I'm also OK with them using Kerbal Alarm Clock, and I don't care which version they're using. I download the KWRocketry mod, and I place the directory that would normally go in KSP's "GameData" directory into "Mods/Required_Exact". I then download the EditorExtensions mod, and I place the directory that would normally go in KSP's "GameData" directory into "Mods/Optional_Exact".
I then download the KerbalAlarmClock mod, and place the directory that would normally go in KSP's "GameData" directory into "Mods/Optional". Now, I start the server and use the "/modgen" command. I will now have a running server that will force clients to have KWRocketry, let them have a specific version of EditorExtensions if they want, let them have any version of KerbalAlarmClock, and not allow them to have any other mods. I can use the /modgen command again if I like (e.g. if I added a new mod), and it will retain any filenames that I've added to the "resource-whitelist" section.
>
Other configuration options are available as well. If you would like to manually configure your KMPModControl.txt file, start the server once (with nothing in any of the "Mods/" directories) and it will auto-generate a basic file. Read the comments to understand exactly how each section works. You will probably only need this option if you want to run a "blacklist" server instead of a "whitelist" server, where any file is allowed except the ones specifically listed. Blacklist servers make it very easy for one client with different mods to mess up the whole system though, so be careful with this.