Update Weather to .NET 8 and add telemetry

This commit is contained in:
2024-01-25 16:25:59 -05:00
parent 2394f613d2
commit 5d0bc2c31c
28 changed files with 856 additions and 775 deletions

View File

@@ -2,21 +2,20 @@
using System.IO;
using System.Reflection;
namespace ChrisKaczor.HomeMonitor.Weather.Service
namespace ChrisKaczor.HomeMonitor.Weather.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();
var assembly = Assembly.GetExecutingAssembly();
using var stream = assembly.GetManifestResourceStream(resourceName);
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();
}
}