Initial commit from private

This commit is contained in:
2019-07-15 20:51:25 -04:00
commit 264f03a22f
55 changed files with 2006 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
using System;
using System.IO;
using System.Reflection;
namespace Weather.Service
{
public static class ResourceReader
{
public static string GetString(string 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())}.");
}
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
}
}