Skip to content

Commit ae74961

Browse files
committed
Using IWebHostEnvironment
1 parent c9c47e1 commit ae74961

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Fritz.StreamTools/Services/TwitchPubSubService.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
using Fritz.StreamTools.Hubs;
33
using Fritz.Twitch;
44
using Fritz.Twitch.PubSub;
5+
using Microsoft.AspNetCore.Hosting;
56
using Microsoft.AspNetCore.SignalR;
67
using Microsoft.Extensions.Configuration;
78
using Microsoft.Extensions.DependencyInjection;
89
using Microsoft.Extensions.Hosting;
10+
using Microsoft.Extensions.Hosting.Internal;
911
using Microsoft.Extensions.Logging;
1012
using Microsoft.Extensions.Options;
1113
using System;
@@ -27,11 +29,11 @@ public class TwitchPubSubService : IHostedService
2729
public static short _OldManCount = 0;
2830
private readonly Twitch.PubSub.Proxy _Proxy;
2931
private readonly ConfigurationSettings _Configuration;
30-
private readonly IHostEnvironment _HostEnvironment;
32+
private readonly IWebHostEnvironment _HostEnvironment;
3133
private readonly ILogger _Logger;
3234
private readonly Dictionary<string, Action<IHubContext<AttentionHub, IAttentionHubClient>>> _ChannelPointActions = new Dictionary<string, Action<IHubContext<AttentionHub, IAttentionHubClient>>>();
3335

34-
public TwitchPubSubService(IServiceProvider serviceProvider, Twitch.PubSub.Proxy proxy, IHostEnvironment hostEnvironment, IOptions<ConfigurationSettings> settings, ILoggerFactory loggerFactory)
36+
public TwitchPubSubService(IServiceProvider serviceProvider, Twitch.PubSub.Proxy proxy, IWebHostEnvironment hostEnvironment, IOptions<ConfigurationSettings> settings, ILoggerFactory loggerFactory)
3537
{
3638
_ServiceProvider = serviceProvider;
3739
_Proxy = proxy;
@@ -67,7 +69,7 @@ public Task StartAsync(CancellationToken cancellationToken)
6769
private void IdentifyOldManAudio()
6870
{
6971

70-
var oldManPath = Path.Combine(_HostEnvironment.ContentRootPath, "wwwroot", "contents", "oldman");
72+
var oldManPath = Path.Combine(_HostEnvironment.WebRootPath, "contents", "oldman");
7173
var di = new DirectoryInfo(oldManPath);
7274

7375
if (di.Exists && di.GetFiles().Any()) {

Fritz.StreamTools/StartupServices/ConfigureSignalrTagHelperOptions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ namespace Fritz.StreamTools.StartupServices
1313
public class ConfigureSignalrTagHelperOptions : IConfigureOptions<SignalrTagHelperOptions>
1414
{
1515

16-
private readonly IHostEnvironment Env;
16+
private readonly IWebHostEnvironment Env;
1717
private readonly ILogger Logger;
1818

19-
public ConfigureSignalrTagHelperOptions(IHostEnvironment env, ILogger<ConfigureSignalrTagHelperOptions> logger)
19+
public ConfigureSignalrTagHelperOptions(IWebHostEnvironment env, ILogger<ConfigureSignalrTagHelperOptions> logger)
2020
{
2121

2222
Env = env;
@@ -27,7 +27,7 @@ public ConfigureSignalrTagHelperOptions(IHostEnvironment env, ILogger<ConfigureS
2727
public void Configure(SignalrTagHelperOptions options)
2828
{
2929

30-
var folder = new DirectoryInfo(Path.Combine(Env.ContentRootPath, "lib", "signalr"));
30+
var folder = new DirectoryInfo(Path.Combine(Env.WebRootPath, "lib", "signalr"));
3131

3232
var fileInfo = folder.Exists
3333
? folder.GetFiles("signalr-client-*.min.js").OrderByDescending(f => f.Name).FirstOrDefault()

0 commit comments

Comments
 (0)