public static ApplicationOptions VerifyOptions() { ApplicationOptions applicationOptions; if (File.Exists(ApplicationOptions.FILE_NAME)) { var bytes = File.ReadAllBytes(ApplicationOptions.FILE_NAME); applicationOptions = bytes.Deserialize <ApplicationOptions>(); } else { applicationOptions = new ApplicationOptions { Endpoint = new EndpointOptions { Host = "*", Port = 2020, FallbackRandom = false }, Authentication = new AuthenticationOptions { Password = nameof(Rhapsody), Endpoints = new List <string> { "/api/search", "/ws" } }, Logging = new LoggingOptions { Filters = new Dictionary <string, LogLevel> { { "System.*", LogLevel.Warning } }, DefaultLevel = LogLevel.Trace }, Providers = Enum.GetNames(typeof(ProviderType)) .ToDictionary(x => x.ToLower(), x => true) }; var serialize = applicationOptions.Serialize(); File.WriteAllBytes(ApplicationOptions.FILE_NAME, serialize); } return(applicationOptions); }