Power service updates

- Upgrade to .NET 8
- Remove ApplicationInsights
- Add OpenTelemetry
This commit is contained in:
2024-01-22 18:54:18 -05:00
parent 911e7fbdb9
commit 2a58b26eb3
16 changed files with 361 additions and 366 deletions

View File

@@ -2,21 +2,20 @@
using System.IO;
using System.Reflection;
namespace ChrisKaczor.HomeMonitor.Power.Service
namespace ChrisKaczor.HomeMonitor.Power.Service;
public static class ResourceReader
{
public static class ResourceReader
public static string GetString(string resourceName)
{
public static string GetString(string resourceName)
{
var assembly = Assembly.GetExecutingAssembly();
using var stream = assembly.GetManifestResourceStream(resourceName);
var assembly = Assembly.GetExecutingAssembly();
using var stream = assembly.GetManifestResourceStream(resourceName);
if (stream == null)
throw new Exception($"Resource {resourceName} not found in {assembly.FullName}. Valid resources are: {string.Join(", ", assembly.GetManifestResourceNames())}.");
if (stream == null)
throw new Exception($"Resource {resourceName} not found in {assembly.FullName}. Valid resources are: {string.Join(", ", assembly.GetManifestResourceNames())}.");
using var reader = new StreamReader(stream);
using var reader = new StreamReader(stream);
return reader.ReadToEnd();
}
return reader.ReadToEnd();
}
}