The revamped blacklist is more compact, which triggers the bug fixed in f090df0db3 (where syncing a smaller new version corrupts the file). This pads the file to the largest previous blacklist size to avoid the issue.
This splits background jobs into:
- a `BackgroundService` which manages the server and retry policy.
- one class per job which defines its logic, schedule options, and state.
This commit:
- moves the malware blacklist into the malware scanner data repo;
- optimizes the format to simplify editing (e.g. to allow multiple IDs/hashes per entry);
- syncs it automatically to the web server;
- and allows SMAPI to launch without the blacklist (in which case it'll resync automatically).
Previously `blacklist-update.json` was updated using `File.OpenWrite`, which doesn't truncate before overwriting. If the previous version was longer, that left the longer part at the end of the file.
Azure App Services doesn't have Git installed on the servers by default, and alternatives like LibGit2Sharp are slower than just redownloading the latest branch when it changes.
This commit:
- removes the 'enable advanced controls' checkbox;
- disables the 'data view' option for simplicity;
- and enables the remaining features which the checkbox toggled.
This commit...
- avoids repeated collection count accesses since we can just track the result while updating;
- and adds more short-circuiting in cases where we know watchers haven't changed.
This commit...
- removes the Lazy<T>, which was unnecessary since mods will virtually always check which buttons were changed;
- avoids a dictionary lookup on each property access;
- and avoids allocating LINQ enumerators, temporary array, and dictionary on init.
Some quick benchmarks show that...
- `new HashSet<T>(values)` (266ns) is 79% faster than `values.ToImmutableHashSet()` (1440ns);
- filling a hash set with a loop (554ns) is 21% faster than filling it from a LINQ enumerable (697ns);
- and searching a `HashSet` (18ns) is 49% faster than searching an `ImmutableHashSet` (35ns).