mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-15 23:29:46 +00:00
ef513e1230
* Bump version to 0.9.10.1 * Bump Microsoft.Web.WebView2 from 1.0.3719.77 to 1.0.3800.47 (#1442) --- updated-dependencies: - dependency-name: Microsoft.Web.WebView2 dependency-version: 1.0.3800.47 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Improve mod view responsiveness (#1443) * Improve application launcher logging (Closes #1441) (#1444) * Damage modifier 0x248 (Closes #1438) (#1445) * Initial commit * Setup generator * Progress * Update generator * Initial commit * Setup generator * Progress * Update generator * Fix library loading * Move code to gwca * Fix leave party * Disable console on Release * Add more exports to gwca * Upgrade gwca * Fixes to character selector * Fix GetWindowHandle * Move character selector to frame based * Fix config spamming --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alexandru Macocian <amacocian@microsoft.com>
36 lines
1.5 KiB
C#
36 lines
1.5 KiB
C#
namespace Daybreak.API.Configuration;
|
|
|
|
public static class WebApplicationBuilderExtensions
|
|
{
|
|
public static WebApplicationBuilder WithConfiguration(this WebApplicationBuilder builder)
|
|
{
|
|
var config = BuildInfo.Configuration;
|
|
var appSettingsStream = GetManifestResourceStream($"Daybreak.API.Configuration.appsettings.json") ?? throw new InvalidOperationException("Failed to load appsettings.json");
|
|
var appSettingsConfigStream = GetManifestResourceStream($"Daybreak.API.Configuration.appsettings.{config}.json") ?? throw new InvalidOperationException($"Failed to load appsettings.{config}.json");
|
|
|
|
// Clear default file-based configuration sources that cause unnecessary reload events
|
|
builder.Configuration.Sources.Clear();
|
|
|
|
builder.Configuration
|
|
.AddJsonStream(appSettingsStream)
|
|
.AddJsonStream(appSettingsConfigStream)
|
|
.AddEnvironmentVariables();
|
|
|
|
builder.WebHost.UseSetting(WebHostDefaults.PreventHostingStartupKey, "true");
|
|
return builder;
|
|
}
|
|
|
|
private static Stream? GetManifestResourceStream(string name)
|
|
{
|
|
var assembly = typeof(WebApplicationBuilderExtensions).Assembly;
|
|
var resourceName = assembly.GetManifestResourceNames()
|
|
.FirstOrDefault(n => n.EndsWith(name, StringComparison.OrdinalIgnoreCase));
|
|
if (resourceName is null)
|
|
{
|
|
return default;
|
|
}
|
|
|
|
return assembly.GetManifestResourceStream(resourceName);
|
|
}
|
|
}
|