mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-29 20:34:04 +02:00
* Switch to .NET Framework 4.7.2 & C# 8.0, update libraries * Add TweetLib.Core project targeting .NET Standard 2.0 * Enable reference nullability checks for TweetLib.Core * Move a bunch of utility classes into TweetLib.Core & refactor * Partially move TweetDuck plugin & update system to TweetLib.Core * Move some constants and CultureInfo setup to TweetLib.Core * Move some configuration classes to TweetLib.Core * Minor refactoring and warning suppression * Add App to TweetLib.Core * Add IAppErrorHandler w/ implementation * Continue moving config, plugin, and update classes to TweetLib.Core * Fix a few nullability checks * Update installers to check for .NET Framework 4.7.2
29 lines
745 B
C#
29 lines
745 B
C#
using System;
|
|
using TweetLib.Core.Application;
|
|
|
|
namespace TweetLib.Core{
|
|
public sealed class App{
|
|
public static IAppErrorHandler ErrorHandler { get; private set; }
|
|
|
|
// Builder
|
|
|
|
public sealed class Builder{
|
|
public IAppErrorHandler? ErrorHandler { get; set; }
|
|
|
|
// Validation
|
|
|
|
internal void Initialize(){
|
|
App.ErrorHandler = Validate(ErrorHandler, nameof(ErrorHandler))!;
|
|
}
|
|
|
|
private T Validate<T>(T obj, string name){
|
|
if (obj == null){
|
|
throw new InvalidOperationException("Missing property " + name + " on the provided App.");
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
}
|
|
}
|
|
}
|