mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-14 01:25:38 -05:00
Update Weather to .NET 8 and add telemetry
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user